#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair <ll,ll> pii;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rept(i,x,y) for(int i=x;i<=y;i++)
#define per(i,x,y) for(int i=x;i>=y;i--)
#define all(x) x.begin(),x.end()
#define pb push_back
#define fi first
#define se second
#define mes(a,b) memset(a,b,sizeof a)
#define mp make_pair
#define dd(x) cout<<#x<<"="<<x<<" "
#define de(x) cout<<#x<<"="<<x<<"\n"
#define debug() cout<<"I love Miyamizu Mitsuha forever.\n"
const int inf=0x3f3f3f3f;
const int maxn=2e5+5;
map<pii,int> m;
pii p[maxn];
const int mod=1000000007;
set<pii> s;
ll qpow(ll a,ll b)
{
	ll ans=1;
	for(;b;b>>=1,a=a*a%mod)
		if(b&1) ans=ans*a%mod;
	return ans;
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin>>n;
	ll zero=0;
	rept(i,1,n)
	{
		ll a,b;
		cin>>a>>b;
		if(a||b)
		{
			ll gcd=__gcd(abs(a),abs(b));
			a/=gcd,b/=gcd;
		}
		if(a<0)
		{
			a=-a;
			b=-b;
		}
		if(a==0&&b!=0)
		{
			b=1;
		}
		if(b==0&&a!=0)
		{
			a=1;
		}
		if(a==0&&b==0)
		{
			zero++;
		}
		p[i]=mp(a,b);
		m[p[i]]++;
//		dd(i);dd(a);de(b);
	}
	ll remain=n;
	remain-=zero;
	ll ans=1;
	rep(i,0,n)
	{
		if(p[i].fi==0||p[i].se==0) continue;
		if(s.find(p[i])!=s.end()) continue;
		pii op=mp(-p[i].se,p[i].fi);
		if(op.fi<0)
		{
			op.fi=-op.fi;
			op.se=-op.se;
		}
		s.insert(p[i]);
		s.insert(op);
	//	dd(op.fi);de(op.se);
		ans=ans*(qpow(2,m[op])+qpow(2,m[p[i]])%mod-1)%mod;
		remain-=m[op];
		remain-=m[p[i]];
	//	dd(i);dd(m[op]);de(m[p[i]]);
	}
	remain-=m[mp(0,1)];remain-=m[mp(1,0)];
	ans=ans*qpow(2,m[mp(0,1)])%mod*qpow(2,m[mp(1,0)])%mod;
	ans=ans*qpow(2,remain)%mod;
	ans--;
	ans=(ans+zero)%mod;
	
	cout<<ans<<"\n";
	return 0;
}