#include <bits/stdc++.h>                                           
 
#define int long long
//#pragma GCC optimize("Ofast")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
 
 
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
#define forev(i, b, a) for(int i = (b); i >= (a); --i)
#define forn(i, a, b) for(int i = (a); i <= (b); ++i)
#define all(x) x.begin(), x.end()
#define sz(s) (int)s.size()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define s second
#define f first
 
 
using namespace std;
 
 
typedef pair < long long, long long > pll;    
typedef pair < int, int > pii;  
typedef unsigned long long ull;         
typedef vector < pii > vpii;                                   	
typedef vector < int > vi;
typedef long double ldb;  
typedef long long ll;  
typedef double db;
 
 
const int inf = 1e9, maxn = 1e6 + 48, mod = 1e9 + 7, N = 2e5 + 24;
const int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1}, block = 555;
const pii base = mp(1171, 3307), Mod = mp(1e9 + 7, 1e9 + 9);
const db eps = 1e-12, pi = acos(-1);
const ll INF = 1e18;


int n, m, aa, bb, a[N], b[N], c[N], cnta, cntb, p[N];
map < pair < pii, int >, int > cnt;
map < pair < pii, int >, bool > was;
vpii v;

main () {
	p[0] = 1;
	for (int i = 1; i < N; ++i)
		p[i] = p[i - 1] * 2 % mod;

	cin >> m;
	while (m--) {
		cin >> aa >> bb;
		if (!aa && !bb)
			continue;
		if (!aa) {
			++cnta;
			continue;
		}

		if (!bb) {
			++cntb;
			continue;
		} 

		++n;
		if (aa < 0) {
			aa = -aa;
			c[n] ^= 1;
		}

		if (bb < 0) {
			bb = -bb;
			c[n] ^= 1;
		}
		int G = __gcd(aa, bb);
		aa /= G;
		bb /= G;

		a[n] = aa;
		b[n] = bb;

		++cnt[{{a[n], b[n]}, c[n]}];
	}

	int ans = (p[cnta] + p[cntb] - 1) % mod;
	
	for (int i = 1; i <= n; ++i) {		
	    pair < pii, int > v1 = {{a[i], b[i]}, c[i]};
	    pair < pii, int > v2 = {{b[i], a[i]}, c[i] ^ 1};	    
		if (was.count(v1))
			continue;

		was[v1] = 1;
		was[v2] = 1;
		ans = ans * (p[cnt[v1]] + p[cnt[v2]] - 1) % mod;
	}
	
	cout << (ans + mod - 1) % mod << endl;
}	#include <bits/stdc++.h>                                           
 
#define int long long
//#pragma GCC optimize("Ofast")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
 
 
#define file(s) freopen(s".in","r",stdin); freopen(s".out","w",stdout);
#define forev(i, b, a) for(int i = (b); i >= (a); --i)
#define forn(i, a, b) for(int i = (a); i <= (b); ++i)
#define all(x) x.begin(), x.end()
#define sz(s) (int)s.size()
#define pb push_back
#define ppb pop_back
#define mp make_pair
#define s second
#define f first
 
 
using namespace std;
 
 
typedef pair < long long, long long > pll;    
typedef pair < int, int > pii;  
typedef unsigned long long ull;         
typedef vector < pii > vpii;                                   	
typedef vector < int > vi;
typedef long double ldb;  
typedef long long ll;  
typedef double db;
 
 
const int inf = 1e9, maxn = 1e6 + 48, mod = 1e9 + 7, N = 2e5 + 24;
const int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1}, block = 555;
const pii base = mp(1171, 3307), Mod = mp(1e9 + 7, 1e9 + 9);
const db eps = 1e-12, pi = acos(-1);
const ll INF = 1e18;


int n, m, aa, bb, a[N], b[N], c[N], cnta, cntb, p[N];
map < pair < pii, int >, int > cnt;
map < pair < pii, int >, bool > was;
vpii v;

main () {
	p[0] = 1;
	for (int i = 1; i < N; ++i)
		p[i] = p[i - 1] * 2 % mod;

	cin >> m;
	while (m--) {
		cin >> aa >> bb;
		if (!aa && !bb)
			continue;
		if (!aa) {
			++cnta;
			continue;
		}

		if (!bb) {
			++cntb;
			continue;
		} 

		++n;
		if (aa < 0) {
			aa = -aa;
			c[n] ^= 1;
		}

		if (bb < 0) {
			bb = -bb;
			c[n] ^= 1;
		}
		int G = __gcd(aa, bb);
		aa /= G;
		bb /= G;

		a[n] = aa;
		b[n] = bb;

		++cnt[{{a[n], b[n]}, c[n]}];
	}

	int ans = (p[cnta] + p[cntb] - 1) % mod;
	
	for (int i = 1; i <= n; ++i) {		
	    pair < pii, int > v1 = {{a[i], b[i]}, c[i]};
	    pair < pii, int > v2 = {{b[i], a[i]}, c[i] ^ 1};	    
		if (was.count(v1))
			continue;

		was[v1] = 1;
		was[v2] = 1;
		ans = ans * (p[cnt[v1]] + p[cnt[v2]] - 1) % mod;
	}
	
	cout << (ans + mod - 1) % mod << endl;
}	