#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep1(i, n) for (int i = 1; i <= (int)(n); i++)
typedef int64_t Int;
typedef pair<Int,Int> p;
const Int MOD = 1e9+7;

Int power(Int a, Int n){
    if(a == 0) return 0;
    if(n == 0) return 1;
    
    Int res = 1;
    while(n > 0){
        if(n % 2 == 1) res = res * a % MOD;
        a = a * a % MOD; n /= 2;
    }
    return res;
}

int main(){ 
    Int N; cin >> N;

    map<p,p> M;
    Int zero_iwashi_count = 0;

    rep(i,N){
        Int A, B; cin >> A >> B;
        if(p(A,B) == p(0,0)){
            zero_iwashi_count++;
            continue;
        } else if (A == 0){
            B = 1;
        } else if (B == 0){
            A = 1;
        } else {
            Int g = __gcd(abs(A),abs(B));
            A /= g; B /= g;
            if(A < 0) {A = -A; B = -B;}
        }

        if(B > 0) M[p(A,B)].first++;
        if(B < 0) M[p(-B,A)].second++;
    }

    Int ans = 1;
    for(auto x : M){
        Int X = x.second.first, Y = x.second.second;

        //cout << X << " " << Y << endl;

        Int now = power(2,X) + power(2,Y) - 1; now %= MOD;
        ans = ans * now % MOD;
    }

    cout <<  (ans + zero_iwashi_count - 1) % MOD << endl;
}
