#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
#define MAX 3000005
#define mod 1000000007
lli a[MAX];
lli b[MAX];
long long binpow(long long a, long long b) {
    lli m = 1000000007;
    a %= m;
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli N;
    cin>>N;
    lli s = 0;
    map <pair <lli,lli> , lli > mp;
    bool flag = false;
    for(lli i = 0; i<N; i++){
        cin>>a[i]>>b[i];
        if((a[i] == 0) & (b[i] == 0)){
            flag = true;
            continue;
        }
        lli gc = __gcd(a[i],b[i]);
        
        gc = abs(gc);
        a[i]/= gc;
        b[i] /= gc;
        
        if(a[i]*b[i] < 0)
            mp[make_pair(-abs(a[i]), -abs(b[i]))]++;
        else{

            mp[make_pair(abs(a[i]), abs(b[i]))]++;
        }
    }
    pair <lli,lli> candi;
    lli ans = 1;
    for(auto i = mp.begin(); i != mp.end(); i++){
        lli a = (*i).first.first;
        lli b = (*i).first.second;
        s = 0;
        if((*i).second == 0)
            continue;
        if(a < 0){
            if(mp[make_pair(abs(b),abs(a))] == 0){
                //cout<<"map: "<<mp[make_pair(abs(b),abs(a))]<<endl;
                s += binpow(2,mp[make_pair(-abs(a), -abs(b))]);
                s %= mod;
               ans *= s;
                ans %= mod;
               // cout<<s<<endl;
            }
        }
        else if(a >= 0){
            s += binpow(2,mp[(*i).first]);
            s %= mod;
            s += binpow(2,mp[make_pair(-abs(b), -abs(a))]);
            s -=1;
            s %= mod;
            ans *= s;
            ans %= mod;
           // cout<<s<<endl;
        }
    }
    ans = ans -1;
    if(flag)
        ans++;
    ans += mod;
    ans %= mod;
    cout<<ans;
}