#include<bits/stdc++.h>
#include<cassert>

using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace __gnu_pbds; 

typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
*/
#define pfi(a) printf("%d",a);
#define pfl(a) printf("%lld",a);
#define pfin(a) printf("%d\n",a);
#define pfln(a) printf("%lld\n",a);
#define sfi(a) scanf("%d",&a);
#define sfl(a) scanf("%lld",&a);
#define pb push_back
#define f(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define inf INT_MAX
#define llinf LONG_LONG_MAX

const int MAXN=2e5+3;
const int M=1000000007;

ll modexp(ll a,ll b){
	if(b==0)
		return 1;
	if(b%2==0)
		return modexp((a*a)%M,b/2);
	else
		return (a*modexp((a*a)%M,b/2))%M;
}

void solve(){
	int n;
	sfi(n)

	map<pair<ll,ll>,ll> mp;

	ll cnt0=0,cnt1=0,cnt2=0;

	f(i,0,n){
		ll x,y;
		sfl(x) sfl(y)

		if(x==0 && y==0){
			++cnt0;
		}

		else if(x==0){
			++cnt1;
		}

		else if(y==0){
			++cnt2;
		}

		else{
			ll x1=abs(x);
			ll y1=abs(y);
			ll g=__gcd(x1,y1);
			x1=x1/g;
			y1=y1/g;

			x=x/g;
			y=y/g;

			if((x1/x)!=(y1/y)){
				x1=-1*x1;
			}
			//cout<<x1<<" "<<y1<<endl;
			mp[{x1,y1}]++;
		}

	}

	ll ans=1;

	for(auto it=mp.begin();it!=mp.end();++it){
		pair<ll,ll> p1=it->first;
		ll cnt=it->second;

		if(cnt==0)
			 continue;

		

		pair<ll,ll> p2;

		if(p1.first>0 && p2.first>0){
			p2.first=-1*p1.second;
			p2.second=p1.first;
		}
		else{
			p2.first=p1.second;
			p2.second=-1*p1.first;
		}

		auto it1=mp.find(p2);

		ll cnt1=0;

		if(it1!=mp.end()){
			//cout<<"**";
			cnt1=(it1->second);
			mp[p2]=0;
		}
		//cout<<cnt1<<" "<<cnt<<endl;
		ll way=modexp(2ll,cnt);
		if(cnt1!=0){
			way+=modexp(2ll,cnt1);
			way%=M;
			way=(way-1+M)%M;
		}
		//cout<<way<<endl;
		ans=(ans*(way))%M;
	}

	ll way=modexp(2,cnt1)+modexp(2,cnt2);

	way=(way-1+M)%M;

	ans=(ans*way)%M;

	ans=(ans-1+M)%M;

	if(cnt0!=0){
		//ans=(ans+1)%M;
	}

	pfln(ans)
}	

int main(){	

	solve();

	return 0;	
}