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

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
typedef long long ll;
typedef pair<int, int> pii;
const int inf=1010001000;
const ll  INF=1001000100010001000;
const int mod=(int)1e9+7;


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

int main(){
    int n;
    cin>>n;
    int c00=0,c01=0;
    map<pair<ll,ll>,pii>m;
    rep(i,0,n){
        ll a,b;
        cin>>a>>b;
        if(a==0 and b==0){
            c00++;
            continue;
        }
        ll const g=__gcd(a,b);
        //cout<<g<<endl;
        //cout<<abs(__gcd(a,b))<<endl;
        a/=g,
        b/=g;
        //cout<<a<<' '<<b<<endl;
        if(b<0)a=-a, b=-b;
        if(a<=0) m[{b,-a}].second++;
        else m[{a,b}].first++;
        /*for(auto p:m){
         cout<<'{'<<p.first.first<<','<<p.first.second<<"} "<<p.second.first<<' '<<p.second.second<<endl;
    }*/
    }
    /*     for(auto p:m){
         cout<<'{'<<p.first.first<<','<<p.first.second<<"} "<<p.second.first<<' '<<p.second.second<<endl;
    }*/
    ll ans=1;
    for(auto p:m){
        ans=(ans*(modpow(2,p.second.first,mod)+modpow(2,p.second.second,mod)-1)%mod)%mod;
    }

    cout<<(ans+c00-1)%mod<<endl;
return 0;
}