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

const int MOD = 1000000007;

vector<int> Power2;

void initPower2(int n){
    ll rtn=1;
    for(int i=0; i<=n; i++){
        Power2.push_back(rtn);//0乗は1
        rtn *= 2;
        rtn %= MOD;
    }
}

ll gcd(ll c, ll d){//c*d=0をもとから除外
    if(c<d)
        swap(c,d);
    while(c%d!=0){
        c %= d;
        swap(c,d);
    }
    return d;
}

//C_i = A_i/B_iが同じものは同一視
//
//C_i = 0/0 -> xyでカウント
//C_i = 1/0 -> xでカウント
//C_i = 0/1 -> yでカウント
//C_i > 0 ->seme
//C_i < 0 ->uke

int main(){
    
    ll n; cin >>n;
    initPower2(n);
    
    ll c,d;
    
    int xy0=0;
    
    map<pair<ll,ll>, pair<int, int>> yuri;
    
    for(int i=0; i<n; i++){
        cin >> c >> d;
        if(!c && !d){//(0,0)
            xy0++;
        }
        else if(!c){//(0,b)
            yuri[{0,1}].first++;
        }else if(!d){//(a,0)
            yuri[{0,1}].second++;
        }else if((c/abs(c))==(d/abs(d))){//傾き正
            
            ll g = gcd( abs(c), abs(d) );
            yuri[{abs(c)/g, abs(d)/g}].first++;
        }else{//傾き負
            
            ll g = gcd( abs(c), abs(d) );
            yuri[{abs(d)/g, abs(c)/g}].second++;
        }
    }
    
    int ans = 1;
    
    for( auto p : yuri){
        int yuriri = Power2((int)p.second.first)-1;
        yuriri += Power2((int)p.second.second);
        yuriri %= MOD;
        ans *= yuriri;
        ans %= MOD;
    }
    
    ans = (ans+MOD-xy0)%MOD;
    cout << ans << endl;
}
