#include <bits/stdc++.h>
using namespace std;

const int64_t MOD = 1000000007;
void add(int64_t& a, int64_t b){
    a = (a+b) % MOD;
}
void mul(int64_t& a, int64_t b){
    a = a*b % MOD;
}

int64_t power_mod(int64_t num, int64_t power){
    int64_t prod = 1;
    num %= MOD;
    while(power > 0){
        if(power&1) prod = prod * num % MOD;
        num = num * num % MOD;
        power >>= 1;
    }
    return prod;
}

int64_t extgcd(int64_t a, int64_t b, int64_t& x, int64_t& y){
    int64_t d = a;
    if(b != 0){
        d = extgcd(b, a%b, y, x);
        y -= (a/b) * x;
    }else{
        x = 1; y = 0;
    }
    return d;
}

int64_t inv_mod(int64_t a){
    int64_t x, y;
    extgcd(a, MOD, x, y);
    return (MOD + x%MOD) % MOD;
}

int main(){
    int N;
    cin >> N;
    map<pair<int64_t, int64_t>, int> mp;
    int z = 0;
    for(int i=0; i<N; i++){
        int64_t a, b;
        cin >> a >> b;
        int64_t g = gcd(abs(a), abs(b));
        if(a < 0) g *= -1;
        if(g){
            a /= g;
            b /= g;
            mp[{a, b}]++;
        }else{
            z++;
        }
    }
    int64_t ans = 1+z;
    while(mp.size()){
        auto p1 = mp.begin()->first;
        int64_t res = power_mod(2, mp[p1]);
        mp.erase(p1);
        auto p2 = make_pair(p1.second, -p1.first);
        if(p2.first < 0){
            p2.first *= -1;
            p2.second *= -1;
        }
        if(mp.count(p2)){
            add(res, power_mod(2, mp[p2])-1);
            mp.erase(p2);
        }
        mul(ans, res);
    }
    add(ans, MOD-1);
    cout << ans << endl;
    return 0;
}
