//by szh
#include<bits/stdc++.h>
using namespace std;

#define pb push_back
#define fi first
#define SZ(x) (int((x).size()))
#define se second
#define ll long long
#define pq priority_queue
#define MP make_pair
#define pii pair<int,int>
#define mod 1000000007
#define inf 0x3f3f3f3f
#define debug(x) cerr<<#x<<"="<<x<<'\n'
#define rep(i, a, b) for (int i=a; i<(b); i++)

int n;
map<pair<ll,ll>,pii> mp;
ll ans=1;

ll p0w(ll base,int p) {
	ll res=1;
	while (p) {
		if (p&1) res=res*base%mod;
		base=base*base%mod;
		p>>=1;
	}
	return res;
}

int main(){
    std::ios::sync_with_stdio(false);
    cin>>n;
    int cnt=0;
    rep(i,0,n) {
    	ll a,b;
    	cin>>a>>b;
    	if (a==0&&b==0) cnt++;
    	else if (a==0) mp[MP(0,0)].fi++;
    	else if (b==0) mp[MP(0,0)].se++;
    	else {
	    	ll c=__gcd(abs(a),abs(b));
	    	a/=c,b/=c;
	    	bool ok=false;
	    	if (a<0&&b<0) a=-a,b=-b;
	    	else if (a<0) a=-a,swap(a,b),ok=true;
	    	else if (b<0) b=-b,swap(a,b),ok=true;
	    	if (ok) mp[MP(a,b)].fi++;
	    	else mp[MP(a,b)].se++;
	    }
	}
	for (map<pair<ll,ll>,pii>::iterator it=mp.begin();it!=mp.end();it++) {
		ans*=((p0w(2,(it->se).fi)+p0w(2,(it->se).se))%mod-1+mod)%mod;
		ans%=mod;
	}
	ans=(ans-1+mod)%mod;
	cout<<ans;
	return 0;
}