#include <bits/stdc++.h>

#define pb push_back

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const ll INF = (ll)1<<62;
const ll MOD = 1e9+7;

ll powx(int b, int exp){
	if(exp == 0)
		return 1;
	ll tmp = powx(b, exp/2);
	ll ans = (tmp*tmp)%MOD;
	if(exp%2)
		ans = (ans*b)%MOD;
	return ans;
}

ll x, y;

ll extended_euclid(ll a, ll b){
	if(b==0){
		x = 1;
		y = 0;
		return a;
	}
	else{
		ll g = extended_euclid(b, a%b);
		/*
			bx + y(a-a/b*b)
			ay + b(x-a/b*y)

		*/
		ll tmp = x;
		x = y;
		y = tmp-a/b*y;
		return g;
	}
}

ll mod_inverse(ll a){
	ll g = extended_euclid(a, MOD);
	while(x<0)
		x+=MOD;
	return x;
}


int main(){
	int n, both_z = 0, num_z = 0, den_z = 0;
	vector<pair<ll, ll> > entries;
	map<pair<ll, ll>, int> fractions; 
	cin>>n;
	for(int i=0;i<n;i++){
		ll a, b, c, d;
		cin>>a>>b;
		c = a; d = b;
		
		if(c==0 && d==0){
			both_z++;
			continue;			
		}
		else if(c==0){
			num_z++;
			continue;
		}
		else if(d==0){
			den_z++;
			continue;
		}

		if(d<0){
			c*=-1; d*=-1;
		}
		
		if(a<0)
			a*=-1;
		if(b<0)
			b*=-1;

		c /= __gcd(a,b);
		d /= __gcd(a,b);

		pair<ll, ll> tmp(c, d);
		if(fractions.count(tmp))
			fractions[tmp]++;
		else
			fractions[tmp] = 1;
	}
	
	ll ans = 1;
	int non_paired = 0, paired = 0;

	if(num_z > 0 && den_z == 0)
		non_paired = num_z;
	else if(num_z == 0 && den_z > 0)
		non_paired = den_z;
	else if(num_z > 0 && den_z > 0)
		ans = (ans* (powx(2, num_z) + powx(2, den_z) - 1))%MOD;

	map<pair<ll, ll>, int>::iterator it;
	
	for(it=fractions.begin();it!=fractions.end();it++){
		ll a1 = (it->first).first, b1 = (it->first).second;
		int cnt1 = it->second;

		ll a2 = -b1, b2 = a1;
		int cnt2 = 0;
		pair<ll, ll> tmp(a2, b2);

		if(fractions.count(tmp)){
			cnt2 = fractions[tmp];
		}

		if(cnt2 == 0){
			non_paired++;
			continue;
		}
		else{
			paired++;
		}

		ans =  (ans*(powx(2, cnt1)+powx(2, cnt2)-1))%MOD;

	}

	ans = (ans*powx(2, non_paired))%MOD;
	ans = (ans*mod_inverse(powx(2, paired)))%MOD;
	ans = (ans-1+MOD)%MOD;

	cout<<ans<<"\n";

	return 0;
}