#include<bits/stdc++.h>
#define pii pair<ll,ll>
using namespace std;
typedef long long ll;
const ll modd=1000000007;
ll n,x,y,cnt_o,ans=1;
unordered_map<pii,ll> cnt_vec,vis;
vector<pii> v;
ll qpow(ll a,ll b) {
	ll ans=1,base=a;
	while(b) {
		if(b&1) ans=ans*base%modd;
		b>>=1,base=base*base%modd;
	}
	return ans;
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	cin>>n;
	for(int i=1; i<=n; i++) {
		cin>>x>>y;
		ll gcd=__gcd(x,y);
		if(!gcd) cnt_o++;
		else {
			x/=gcd,y/=gcd;
			if(x<0) x*=-1,y*=-1;
			cnt_vec[make_pair(x,y)]++;
			if(!vis[make_pair(x,y)])
			v.push_back(make_pair(x,y)),
			vis[make_pair(x,y)]=1;
		}
	}
	for(int i=0; i<v.size(); i++) {
		ll tx=v[i].first,ty=v[i].second;
		ll cur=qpow(2,cnt_vec[v[i]]);
		swap(tx,ty),ty=-ty;
		if(tx<0) tx*=-1,ty*=-1;
		if(cnt_vec[make_pair(tx,ty)]) {
			cur=(qpow(2,cnt_vec[v[i]])+qpow(2,cnt_vec[make_pair(tx,ty)])-1)%modd;
			cnt_vec[make_pair(tx,ty)]=cnt_vec[v[i]]=0;
		}
		ans=ans*cur%modd;
	}
	ans=(ans+cnt_o-1)%modd+modd;
	cout<<ans%modd;
	return 0;
}