#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(int i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
ll ans=1;
const ll MOD = 1000000007;

ll modpow(ll a,ll n,ll mod=MOD) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

void Main(){
    ll n;cin>>n;
    vector<ll> a(n),b(n);
    map<pair<ll,ll>,ll> ab;
    ll anszero=0;
    For(i,0,n) {
        cin >> a[i] >> b[i];
        if(a[i]!=0LL && b[i]!=0LL){
            ll sign=1;
            if((a[i]>0LL && b[i]<0LL) || (a[i]<0LL && b[i]>0LL)){//片方だけ負
                sign=-1;
            }
            a[i]=abs(a[i]);
            b[i]=abs(b[i]);
            ll GCD = gcd(a[i],b[i]);
            a[i]/=GCD;
            b[i]/=GCD;
            ab[make_pair(a[i],b[i]*sign)]++;//符号はbに入れる
        }
        else if(a[i]==0LL && b[i]!=0LL){
            ab[make_pair(0,1)]++;
        }
        else if(a[i]!=0LL && b[i]==0LL){
            ab[make_pair(1,0)]++;
        }
        else{
            anszero++;
        }
    }
    for(auto p:ab){
        ll A=p.first.first;
        ll B=p.first.second;
        pair<ll,ll> opp;
        if(B<0LL){
            opp = make_pair(-B,A);
        }
        else{
            opp = make_pair(B,-A);
        }
        ll num1=p.second;
        ll num2=ab[opp];
        ll num=modpow(2,num1)+modpow(2,num2)-1;
        num%=MOD;
        ans*=num;
        ans%=MOD;
        ab[p.first]=0;
        ab[opp]=0;
    }
    ans--;
    ans+=anszero;
    ans%=MOD;
    cout << ans << endl;
}
int main(){
    Main();
    /*
    東方風神録は神が出てくるので当然神ゲー
    */
    return 0;
}