/*** author: yuji9511 ***/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using lpair = pair<ll, ll>;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i=(m);i<(n);i++)
#define rrep(i,m,n) for(ll i=(m);i>=(n);i--)
#define printa(x,n) for(ll i=0;i<n;i++){cout<<(x[i])<<" \n"[i==n-1];};
void print() {}
template <class H,class... T>
void print(H&& h, T&&... t){cout<<h<<" \n"[sizeof...(t)==0];print(forward<T>(t)...);}
ll power(ll x, ll n){
    if(n == 0) return 1LL;
    ll res = power(x * x % MOD, n/2);
    if(n % 2 == 1) res = res * x % MOD;
    return res;
}

void solve(){
    ll N;
    cin >> N;
    ll A[200010], B[200010];
    rep(i,0,N) cin >> A[i] >> B[i];
    map<lpair,ll> mp;
    rep(i,0,N){
        if(A[i] == 0 && B[i] == 0){
            continue;
        }else if(A[i] == 0){
            mp[{0,1}]++;
        }else if(B[i] == 0){
            mp[{1,0}]++;
        }else{
            ll v = gcd(abs(A[i]),abs(B[i]));
            A[i] /= v;
            B[i] /= v;
            if(A[i] < 0){
                A[i] *= -1;
                B[i] *= -1;
            }
            mp[{A[i], B[i]}]++;
        }
    }
    ll ans = 1;
    map<lpair, ll> check;
    for(auto &e: mp){
        lpair l1 = e.first;
        if(check[l1]) continue;
        ll n = e.second;
        lpair l2 = {l1.second, -l1.first};
        if(l2.first < 0){
            l2.first *= -1;
            l2.second *= -1;
        }
        
        check[l2]++;
        if(mp[l2] == 0){
            // print(l1.first, l1.second);
            ll v = power(2, n);
            ans *= v;
            ans %= MOD;
        }else{
            ll v = power(2,n) + power(2,mp[l2]) - 1 + MOD;
            v %= MOD;
            ans *= v;
            ans %= MOD;
        }
        check[l1]++;

    }
    ans = (ans - 1 + MOD) % MOD;
    print(ans);

    

}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
}