#pragma GCC optimize("Ofast","inline","-ffast-math")
#pragma GCC target("avx,sse2,sse3,sse4,mmx")
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/hash_policy.hpp>
#define int long long
#define double long double
#define MOD 1000000007ll 
using namespace __gnu_pbds;
using namespace std;

int n,a[200010],b[200010],pw[200010];
double val[200010];
map<double,int> mp; 

signed main()
{
	ios::sync_with_stdio(false);
	cin>>n;
	pw[0]=1ll;
	for(int i=1;i<=n;i++){
		pw[i]=(pw[i-1]*2ll)%MOD;
	}
	int cnt=0;
	for(int i=1;i<=n;i++){
		cin>>a[i]>>b[i];
		if(a[i]==0&&b[i]==0) continue;
		cnt++;
		if(b[i]==0) val[i]=-1e20;
		else val[i]=(double)a[i]*1.0/(double)b[i];
		mp[val[i]]++;
	}
	int ans=1ll;
	for(map<double,int>::iterator it=mp.begin();it!=mp.end();it++){
		double num=it->first;
		double nxt=-1e21;
		if(num==-1e20) nxt=0.0;
		else if(num==0.0) nxt=-1e20;
		else if(mp[-1.0/num]) nxt=-1.0/num;
		if(num>=0.0){
			if(nxt==-1e21){
				ans=(ans*pw[it->second])%MOD;
			}
		}
		else{
			if(nxt==-1e21){
				ans=(ans*pw[it->second])%MOD;
			}
			else ans=(ans*((pw[it->second]+pw[mp[nxt]]-1ll+MOD)%MOD))%MOD;
		}
	}
	if(cnt<n) ans+=n-cnt;
	cout<<(ans-1ll+MOD)%MOD<<endl;
	return 0;
}