#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int Inf = 1000000000;
constexpr ll INF= 1e18;
constexpr ll MOD = 1000000007;
const double PI = 3.1415926535897;
typedef pair<ll,ll> P;
 
template<typename T>
T Pow(T a,T b) {
    T ret = 1;
    for(int i = 0;i < b;i++) {
        ret *= a;
    }
    return ret;
}
 
ll mod(ll val) {
    ll res = val % MOD;
    if(res < 0) {
        res += MOD;
    }
    return res;
}
 
ll RepeatSquaring(ll N, ll P, ll M){
    if(P==0) return 1;
    if(P%2==0){
        ll t = RepeatSquaring(N, P/2, M);
        return t*t % M;
    }
    return N * RepeatSquaring(N, P-1, M) % M;
}

int main() {
    int N;
    cin >> N;
    map<P,ll> ma;
    ll zero = 0;
    for(int i = 0;i < N;i++) {
        ll A,B;
        cin >> A >> B;
        if(A == 0 && B == 0) {
            zero++;
        }
        else if(A == 0) {
            ma[P(0,1)]++;
        }
        else if(B == 0) {
            ma[P(1,0)]++;
        }
        else {
            ll a = abs(A);
            ll b = abs(B);
            ll cnt = gcd(a,b);
            A /= cnt;
            B /= cnt;
            if(A < 0 && B < 0) {
                A = -A;
                B = -B;
            }
            ma[P(A,B)]++;
        }
    }
    ll ret = 1;
    for(auto z:ma) {
        P key = z.first;
        ll value = z.second;
        if(value == 0) {
            continue;
        }
        ll value2 = 0;
        if(key.first == 0 && key.second == 1) {
            value2 = ma[P(1,0)];
            ma[P(1,0)] = 0;
            ma[P(0,1)] = 0;
        }
        else if(key.first == 1 && key.second == 0) {
            value2 = ma[P(0,1)];
            ma[P(1,0)] = 0;
            ma[P(0,1)] = 0;
        }
        else {
            if(key.first > 0 && key.second > 0) {
                value2 += ma[P(-key.second,key.first)];
                value2 += ma[P(key.second,-key.first)];
                ma[key] = 0;
                ma[P(-key.second,key.first)] = 0;
                ma[P(key.second,-key.first)] = 0;
            }
            else {
                value2 += ma[P(abs(key.second),abs(key.first))];
                ma[key] = 0;
                ma[P(abs(key.second),abs(key.first))] = 0;
            }
        }
        ll cnt3 = RepeatSquaring(2,value,MOD) + RepeatSquaring(2,value2,MOD) - 1;
        cnt3 %= MOD;
        ret *= cnt3;
        ret %= MOD;
    }
    ret--;
    ret += zero;
    ret %= MOD;
    cout << ret << endl;
}