#include <bits/stdc++.h>

using namespace std;

using LL = long long;
const LL MOD = (LL)1e9 + 7;
const LL NS = (LL)2e5 + 4;
LL N;
LL A[NS], B[NS], tpow[NS];
map < pair < LL, LL >, LL > cnt;

int main(){
    tpow[0] = 1;
    for(int i = 1; i < NS; ++i){
        tpow[i] = tpow[i - 1] * 2 % MOD;
    }
    for(int i = 0; i < NS; ++i){
        --tpow[i];
        if(tpow[i] < 0) tpow[i] += MOD;
    }
    scanf("%lld", &N);
    LL ans = 1;
    for(LL i = 0; i < N; ++i){
        scanf("%lld %lld", A + i, B + i);
        if(A[i] == B[i] && !A[i]){
            ++ans;
            continue;
        }
        if(B[i] == 0){
            ++cnt[{(LL)3e18, (LL)3e18}];
            continue;
        }
        LL absA = abs(A[i]), absB = abs(B[i]);
        LL gcd = __gcd(absA, absB);
        if(B[i] < 0){
            B[i] *= -1, A[i] *= -1;
        }
        ++cnt[{A[i] / gcd, B[i] / gcd}];
    }
    for(auto&div:cnt){
        if(!div.first.second){
            continue;
        }
        if(!div.first.first){
            ans *= tpow[div.second] + tpow[cnt[{(LL)3e18, (LL)3e18}]] + 1;
            ans %= MOD;
            div.second = cnt[{MOD, MOD}] = 0;
            continue;
        }
        pair < LL, LL > now = div.first;
        pair < LL, LL > op = {now.second, -now.first};
        if(op.second < 0){
            op.first *= -1, op.second *= -1;
        }
        LL absA = abs(op.first), absB = abs(op.second);
        LL gcd = __gcd(absA, absB);
        op = {op.first / gcd, op.second / gcd};
        ans *= tpow[div.second] + tpow[cnt[op]] + 1;
        div.second = cnt[op] = 0;
        ans %= MOD;
    }
    --ans;
    if(ans < 0) ans += MOD;
    printf("%lld\n", ans);
    return 0;
}
