#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll zero = 0;
const ll INF = 3000000000000000000; //3*10^18
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;

ll po(ll a, ll b){
    ll res = 1;
    ll tmp = a;
    while(b > 0){
        if(b % 2 == 1) res = res * tmp % MOD;
        b = b / 2;
        tmp = tmp*tmp % MOD; 
    }
    return res;
}

int main(){
    ll N;
    cin >> N;
    vector<ll> a(N),b(N);
    for (ll i = 0; i < N; i++) {
        cin >> a[i] >> b[i];
    }
    map<pair<ll,ll>, pair<ll,ll>> M;
    ll tmp;
    ll cnt = 0;
    for (ll i = 0; i < N; i++) {
        if(a[i] < 0 && b[i] < 0){
            a[i] = -1*a[i];
            b[i] = -1*b[i];
        }
        if(b[i] < 0){
            a[i] = -1*a[i];
            b[i] = -1*b[i];
        }
        if(a[i] == 0 && b[i] == 0){
            cnt += 1;
            continue;
        }
        else if(b[i] == 0){
            if(!M.count(make_pair(INF,0))){
                M[make_pair(INF,0)] = make_pair(zero,zero);
            }
            M[make_pair(INF,0)].first++;
        }
        else if(a[i] == 0){
            if(!M.count(make_pair(INF,0))){
                M[make_pair(INF,0)] = make_pair(zero,zero);
            }
            M[make_pair(INF,0)].second++;
        }
        else{
            tmp = __gcd(a[i], b[i]);
            a[i] = a[i] / tmp;
            b[i] = b[i] / tmp;
            if(a[i] > 0){
                if(!M.count(make_pair(a[i],b[i]))){
                    M[make_pair(a[i],b[i])] = make_pair(zero,zero);
                }
                M[make_pair(a[i],b[i])].first++;
            }
            else{
                a[i] = -1*a[i];
                if(!M.count(make_pair(b[i],a[i]))){
                    M[make_pair(b[i],a[i])] = make_pair(zero,zero);
                }
                M[make_pair(b[i],a[i])].second++;
            }
        }

    }
    ll ans;
    ans = 1;
    for (pair<pair<ll,ll>, pair<ll,ll>> p : M){
        if(p.second.first == 0){
            tmp = po(2, p.second.second) % MOD;
        }
        else if(p.second.second == 0){
            tmp = po(2, p.second.first) % MOD;
        }
        else{
            tmp = (po(2, p.second.first)%MOD + po(2, p.second.second)%MOD +MOD - 1) % MOD;
        }
        ans = ans * tmp % MOD;
    }
    ans = (MOD + ans - 1) % MOD;
    ans = (ans + cnt) %MOD;
    printf("%lld\n", ans);

    
}