#include <bits/stdc++.h>

using namespace std;

typedef long long	ll;

typedef pair< ll, ll >	pll;
map< pll, ll > cnt;

const int N = int(2e5) + 100;
ll a[N], b[N];
const ll mod = ll(1e9) + 7LL;

ll fast_pow(ll x, ll e){
	ll b = x;
	ll r = 1LL;

	while(e){
		if(e & 1LL){
			r = (r * b) % mod;
		}

		e >>= 1LL;
		b = (b * b) % mod;
	}

	return r;
}

int main(){
	int n;

	scanf("%d", &n);

	ll joker = 0LL;

	for(int i = 0 ; i < n ; i++){
		scanf("%lld %lld", &a[i], &b[i]);

		if(a[i] == 0 && b[i] == 0){
			joker++;
			continue;
		}

		ll g = __gcd(a[i], b[i]);	
		a[i] /= g;
		b[i] /= g;

		if(a[i] < 0){
			a[i] *= -1LL;
			b[i] *= -1LL;
		}

		cnt[{a[i], b[i]}]++;
	}

	ll tot = 1LL;
	ll qtdg = 0;
	ll add = 0LL;

	for(auto u: cnt){
		if(u.first.second < 0){
			continue;
		}

		auto v = u.first;
		swap(v.first, v.second);

		v.second *= -1;

		// cout << u.first.first << " " << u.first.second << " | " << v.first << " " << v.second << endl;

		if(cnt.count(v) == 0){
			qtdg++;
		}else{
			add += cnt[u.first] + cnt[v];

			// cout << cnt[u.first] << " " << cnt[v] << " " << v.first << " " << v.second << endl;

			tot = (tot * ((fast_pow(2LL, cnt[u.first]) + fast_pow(2LL, cnt[v]) - 1LL) % mod) % mod) % mod;
		}
	}


	tot = (tot * fast_pow(2LL, ll(n) - add)) % mod;
	tot = (tot - 1LL + joker) % mod;

	printf("%lld\n", tot);

	return 0;
}