#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+5,mod=1e9+7;
#define mst(a) memset(a,0,sizeof a)
int n,cnt;
ll ksm(ll a,ll n){
	ll ans=1;
	while(n){
		if(n&1) ans=ans*a%mod;
		a=a*a%mod;
		n>>=1;
	}
	return ans;
}
int main(){
	map<pair<ll,ll>,pair<int,int> >mp;
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		ll a,b;
		scanf("%lld%lld",&a,&b);
		if(!a&&!b){
			cnt++;
			continue;
		}
		ll g=__gcd(a,b);
		a/=g,b/=g;
		if(b<0) a=-a,b=-b;
		if(a<=0) mp[{b,-a}].second++;
		else mp[{a,b}].first++;	
	}
	ll ans=1;
	for(auto it:mp){
		ans=(ans*(ksm(2,it.second.first)+ksm(2,it.second.second)-1)%mod)%mod;
	}
	printf("%lld\n",ans+cnt-1);
	return 0;
}  