#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1000000007;
const ll maxn=200005;
ll gcd(ll a,ll b){
	return b?gcd(b,a%b):a;
}
ll quickp(ll a,ll n){
	ll ans=1;
	while(n){
		if(n&1) ans=a*ans%mod;
		a=a*a%mod;
		n>>=1;
	}
	return ans;
}

int main(){
	int n;
	scanf("%d",&n);
	map<pair<ll,ll>,pair<int,int>>mp;
	int zero=0;
	ll sum=1;
	for(int i=1;i<=n;i++){
		ll a,b;
		scanf("%lld%lld",&a,&b);
		if(a==0&&b==0){zero++;continue;}
		ll g=gcd(a,b);
		a/=g,b/=g;
		if(b<0) b=-b,a=-a;
		if(a<=0) mp[make_pair(b,-a)].second++;
		else mp[make_pair(a,b)].first++;
	}
	for(auto it=mp.begin();it!=mp.end();it++){
		sum=(quickp(2,it->second.first)+quickp(2,it->second.second)-1)%mod*sum%mod;
	}
	sum=(sum+zero-1)%mod;
	sum=(sum%mod+mod)%mod;
	printf("%lld\n",sum);
}