#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
const LL mod=1000000007;
const LL LINF=1LL<<62;
const int INF=1<<30;
int dx[]={1,0,-1,0,1,-1,1,-1};
int dy[]={0,1,0,-1,1,-1,-1,1};


LL fpow(LL a, LL n, LL mod){
    LL x = 1;
    while(n > 0){
        if(n&1){
            x=x*a%mod;
        }
        a=a*a%mod;
        n >>= 1;
    }
    return x;
}

struct E{LL a;LL b;bool f;
    bool operator<(const E& value) const{
        if(a == value.a){
            if(b == value.b){
                return f < value.f;
            }
            else{
                return b < value.b;
            }
        }
        else{
            return a < value.a;
        }
    };
};

int main(){
    int n;cin >> n;
    map<E,LL> ma;
    vector<LL> a(n),b(n);
    LL cnt = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
        if(a[i] == 0 && b[i] == 0){
            cnt++;
            continue;
        }
        LL g = gcd(abs(a[i]), abs(b[i]));
        a[i] /= g, b[i] /= g;
        if((a[i] > 0 && b[i] > 0) || (a[i] < 0 && b[i] < 0)){
            E e = E({abs(a[i]), abs(b[i]), false});
            ma[e]++;
        }
        else if((a[i] < 0 && b[i] > 0) || (a[i] > 0 && b[i] < 0)){
            E e = E({abs(a[i]), abs(b[i]), true});
            ma[e]++;
        }
        else if(a[i] == 0){
            E e = E({0LL, 1LL, true});
            ma[e]++;
        }
        else if(b[i] == 0){
            E e = E({1LL, 0LL, true});
            ma[e]++;
        }
    }
    map<E, bool> f;
    vector<P> v;
    for (int i = 0; i < n; i++) {
        if(a[i] == 0 && b[i] == 0) continue;
        E e, re;
        if((a[i] > 0 && b[i] > 0) || (a[i] < 0 && b[i] < 0)){
            e = E({abs(a[i]), abs(b[i]), false});
            re = E({abs(b[i]), abs(a[i]), true});
        }
        else if((a[i] < 0 && b[i] > 0) || (a[i] > 0 && b[i] < 0)){
            e = E({abs(a[i]), abs(b[i]), true});
            re = E({abs(b[i]), abs(a[i]), false});
        }
        else if(a[i] == 0){
            e = E({0LL, 1LL, true});
            re = E({1LL, 0LL, true});
        }
        else if(b[i] == 0){
            e = E({1LL, 0LL, true});
            re = E({0LL, 1LL, true});
        }
        if(f[e] || f[re]) continue;
        f[e] = true, f[re] = true;
        LL s = ma[e];
        LL p = ma[re];
        v.pb(mp(s, p));
    }
    vector<LL> dp(v.size()+1,0);
    dp[0] = 1;
    LL sum = cnt;
    for (int i = 0; i < v.size(); i++) {
        sum += v[i].fs + v[i].sc;
        LL t1 = (fpow(2, v[i].fs, mod) - 1 + mod)%mod;
        LL t2 = (fpow(2, v[i].sc, mod) - 1 + mod)%mod;
        LL t = (t1 + t2 + 1)%mod;
        dp[i + 1] = dp[i] * t %mod;
    }
    assert(sum == n);
    cout << (dp[v.size()] - 1 + mod + cnt)%mod << endl;
    return 0;
}


Measured memory_bytes: 73520