#include <bits/stdc++.h>
 
#define f(i,a,b) for( ll i = a; i < b ; i++ ) 
#define af(i,a,b) for( ll i = a; i >= b ; i--)
#define rep(i,a,b,k) for(ll i = a; i < b ; i+= k )
#define arep(i,a,b,k) for( ll i = a; i >= b ; i-= k)
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(a) (ll) a.size()
#define all(a) a.begin(), a.end()
#define sor(a) sort( a.begin(), a.end() )
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define inter ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nuintptr)
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> ii ;
typedef vector<ll>  vi ;
typedef vector<ii> vii ;
 
const int MAX= 1e6+10;
const ll inf =9;


map<ii,ll> m;
ll pot[MAX],mod=1e9+7;

ll sig(ll x){
	return (x>0?1:-1);
}
ii inv(ii x){
	return mp(-1*(sig(x.ff))*x.ss,abs(x.ff));
}

int main(){
	fastio;
	pot[0]=1;
	f(i,1,MAX) pot[i]=(2LL*pot[i-1])%mod;
	ll tc,n,a,b,p=0,q=0,r=0;
	cin>>n;
	f(i,0,n){
		cin>>a>>b;
		if(a==0 && b==0) r++;
		else if(a==0) p++;
		else if(b==0) q++;
		else{
			if(b<0) a*=-1,b*=-1;
			m[{a/__gcd(a,b),b/__gcd(a,b)}]++;
		}
	}
	ll ans=1;
	if(r==n) {
		cout<<n<<endl;
		continue;
	}
	
	(ans*=(r + pot[p] + pot[q] -1 )%mod )%=mod; ;
	
	for(auto it:m){
		ii x = it.ff; 
		ii y = inv(x);
		m[y];
		if(x.ff<0) continue;
/*		if(m[y]==0) (ans*=(pot[m[x]]))%=mod;
		else if(m[x]==0) (ans*=(pot[m[y]]))%=mod;
		else{
*/			(ans*=(  (pot[m[x]] + pot[m[y]] -1+mod)%mod ) )%=mod;
//		} 
	}
	cout<<(ans-1+mod)%mod<<endl;
}