#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define llinf (1ll<<62)
#define BG(x) ((x).begin())
#define ED(x) ((x).end())
#define rBG(x) ((x).rbegin())
#define rED(x) ((x).rend())
#define mp(a, b) make_pair((a), (b))

ll t;

ll n, m = 1000000007;
map<pair<ll, ll>, ll> ab[2];
ll zp, pz, zz;
ll ans = 1;

ll gcd(ll a, ll b) {
	if(!b) {
		return a;
	}
	return gcd(a % b, a);
}

ll fast_p(ll a, ll b) {
	ll now = a, ans = 1;
	for(int i = 0; i < 32; i++) {
		if((1<<i) & b) {
		//	cout << i << ' ' << b << '\n';
			ans *= now;
			ans %= m;
		}
		now = now*now%m;
	}
	return ans;
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
//    cin >> t;
    t = 1;
    
	
	
    for(int _ = 1; _ <= t; _++) {
    //    cout << "Case #" << _ << ": ";
        
		cin >> n;
		for(int i = 0; i < n; i++) {
			ll a, b;
			cin >> a >> b;
			if(a && b) {
				if(double(a) / b > 0) {
					ll gcdab = __gcd(abs(a), abs(b));
					ab[0][mp(abs(a)/gcdab, abs(b)/gcdab)]++;
				}
				else {
					ll gcdab = __gcd(abs(a), abs(b));
					ab[1][mp(abs(a)/gcdab, abs(b)/gcdab)]++;
				}
			}
			else {
				if(a) {
					pz++;
				}
				else if(b) {
					zp++;
				}
				else {
					zz++;
				}
			}
		}
		ans *= (fast_p(2, pz)+fast_p(2, zp)-1);
		ans %= m;
		while(ab[0].size()) {
			auto now = BG(ab[0])->first;
			auto won = mp(now.second, now.first);
			ans *= (fast_p(2, ab[0][now])+fast_p(2, ab[1][won])-1);
		//	cout << fast_p(2, ab[0][now]) << ' ' << fast_p(2, ab[1][won]) << ' ';
		//	cout << now.first << ' ' << now.second << ' ';
		//	cout << won.first << ' ' << won.second << '\n';
			ans %= m;
			ab[0].erase(now);
			ab[1].erase(won);
			
		}
		while(ab[1].size()) {
			auto now = BG(ab[1])->first;
			auto won = mp(now.second, now.first);
			ans *= (fast_p(2, ab[1][now])+fast_p(2, ab[0][won])-1);
			ans %= m;
			ab[1].erase(now);
			ab[0].erase(won);
		}
		cout << (ans - 1 + zz) % 1000000007 << '\n';
    }
    return 0;
}