#include "bits/stdc++.h"

#define pb push_back
#define ld long double
#define ll long long
#define f first
#define s second

using namespace std;

const ll MOD = 1e9 + 7;
const ll MOD2 = 2468777687;

ll n;
vector<ll> t;
map<ll, ll> v;
ll exp(ll a, ll x){
    if(x == 0) return 1;
    ll tmp = exp(a, x/2);
    tmp *= tmp;
    tmp %= MOD2;
    if(x%2) tmp *= a;
    tmp %= MOD2;
    return tmp;
}

ll inv(ll x){
    return exp(x, MOD2 - 2);
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n;
    ll o = 0, e = 0, c = 0; 
    for(int i = 0; i < n; ++i){
        ll a, b;
        cin >> a >> b;
        if(a == 0 && b == 0) c++;
        else if(a == 0) e++;
        else if(b == 0) o++;
        else{
            a = ((a % MOD2) + MOD2) % MOD2;
            b = ((b % MOD2) + MOD2) % MOD2;
            v[(a * inv(b))%MOD2]++;
        }
    }
    t.assign(2e5 + 5, 1);
    for(int i = 1; i < t.size(); ++i){
        t[i] = 2 * t[i - 1];
        t[i] %= MOD;
    }
    ll res = 1;
    set<ll> done;
    for(auto i : v){
        if(done.find(i.f) != done.end()) continue;
        ll oth = (inv((-i.f + MOD2)%MOD2) + MOD2)%MOD2;
        ll cur = (t[i.s] + t[v[oth]])%MOD;
        cur--;
        res *= cur;
        res %= MOD;
        // cout << i.f << " " << i.s << " " << oth << " " << cur << "\n";
        // cout << cur << "\n";
        done.insert(i.f);
        done.insert(oth);
    }
    res *= ((t[o] + t[e]) - 1 + MOD)%MOD;
    res %= MOD;
    if(c > 0) res += c;
    cout << (res - 1 + MOD)%MOD;
    return 0;
}