#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using PLL = pair<ll, ll>;
constexpr ll MOD = 1e9+7;

ll modpow(ll a, ll n){
    ll ret = 1;
    while(n > 0){
        if(n & 1) ret = ret * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return ret;
}

int main(){
    int n;
    cin >> n;
    map<PLL, PLL> mp;
    ll zero = 0;
    for(int i = 0; i < n; i++){
        ll l, r;
        cin >> l >> r;
        if(r < 0){
            l = -l;
            r = -r;
        }
        if(r == 0 && l == 0) zero++;
        else{//0<= sita <= 2/pi にしたい
            ll dv = abs(__gcd(l, r));
            if(l == 0) mp[make_pair(0, 1)].first++;
            else if( r == 0) mp[make_pair(0, 1)].second++;
            else if(l > 0){
                mp[make_pair(l/dv, r/dv)].first++;
            }
            else mp[make_pair(r/dv, -l/dv)].second++;
        }
    }

    ll ans = 1;
    for(auto p : mp){
        ans *= (modpow(2, p.second.first) + modpow(2, p.second.second) - 1) % MOD;
    }
    cout << (ans - 1 + zero) % MOD << endl; // ansの一つも入れない場合を除く、ansとzeroは完全に独立で一緒にはいれられない
}