#include "bits/stdc++.h"
using namespace std;

#define DEBUG
#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
	template <typename Arg1>
	void __f(const char* name, Arg1&& arg1)
	{
		cerr << name << " = " << arg1 << endl;
	}
	template <typename Arg1, typename... Args>
	void __f(const char* names, Arg1&& arg1, Args&&... args)
	{
		const char* comma = strchr(names + 1, ','); cerr.write(names, comma - names) << " = " << arg1 << " || ";
		__f(comma+1, args...);
	}
#else
#define debug(...)
#endif

template <class Ch, class Tr, class Container>
basic_ostream <Ch, Tr> & operator << (basic_ostream <Ch, Tr> & os, Container const& x) {
    os << "{ ";
    for(auto& y : x) os << y << " ; ";
    return os << "}";
}

template <class X, class Y>
ostream & operator << (ostream & os, pair <X, Y> const& p) {
	return os << "[ " << p.first << ", " << p.second << "]" ;
}

#define FAST_IO std::ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long int
#define pb push_back
#define mp make_pair
#define ld long double
#define sz(a) (ll)(a).size()
#define endl "\n"

const int MAXN = 2e5 + 5;

ll n, mod = 1e9 + 7, a[MAXN], b[MAXN], c1 = 0, c2 = 0, ans = 1;
map<pair<ll,ll>, bool>done;
map<pair<ll,ll>, ll>cnt;
set<pair<ll,ll>>s;

ll power(ll a, ll b)
{
	ll ans = 1;
	while(b > 0)
	{
		if(b & 1ll) ans = (ans * a) % mod;
		a = (a * a) % mod;
		b >>= 1ll;
	}
	return ans;
}

int main()
{
	FAST_IO;

	cin >> n;
	for(int i=0;i<n;i++) 
	{	
		cin >> a[i] >> b[i];
		if(!a[i] && !b[i]) continue;
		else if(!a[i]) c1 += 1;
		else if(!b[i]) c2 += 1;
		else
		{
			if((a[i] < 0 && b[i] < 0) || (a[i] > 0 && b[i] < 0)) a[i] *= -1, b[i] *= -1;
			ll g = __gcd(a[i], b[i]);
			a[i] /= g;
			b[i] /= g;
			s.insert({a[i], b[i]}); 
			cnt[{a[i], b[i]}] += 1;
		}
	}	
	ans = (((power(2, c1) - 1) % mod + mod) % mod + ((power(2, c2) - 1) % mod + mod) % mod + 1) % mod;
	for(auto it : s)
	{
		if(done[it]) continue;
		done[it] = 1;
		ll x1 = cnt[it];
		ll num = -it.second;
		ll den = it.first;
		if((num < 0 && den < 0) || (num > 0 && den < 0)) num *= -1, den *= -1;
		done[{num, den}] = 1;
		ll x2 = cnt[{num, den}];
		ans = (ans * (((power(2, x1) - 1) % mod + mod) % mod + ((power(2, x2) - 1) % mod + mod) % mod + 1)) % mod;
	}
	cout << ((ans - 1) % mod + mod) % mod << endl;
	return 0;	
}