#include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
typedef long long ll;
#define MOD 1000000007
using namespace std;
long long int gcd2( long long int a, long long int b ) {

    if ( ( a % b ) == 0 ) return b;
    return gcd2( b, a % b );

}
long long int gcd( long long int a, long long int b ) {
    if ( a < 0 ) a = -a;
    if ( b < 0 ) b = -b;
    if ( a == 0 ) {
        if ( b == 0 ) return 1;
        return b;
    }
    if ( b == 0 ) return a;
    return gcd2( a, b );
}

ll modpow(ll a, ll n, ll mod = MOD) {
    ll res = 1;
    for ( ll i = 0; i < n; i++ ) {
        res *= a;
        res %= mod;
    }
    return res;
}

ll sign(ll n) {
    if(n >= 0) {
        return 1;
    } else {
        return -1;
    }
}

int main() {

    int n;
    cin >> n;

    map<pair<ll, ll>, ll> cnt;
/*
    for(int i = 0; i < n; i++) {
        ll a, b;
        cin >> a >> b;
        if(a == 0 && b == 0) {
            cnt[make_pair(0, 0)]++;
        } else if(a == 0 && b != 0) {
            cnt[make_pair(0, 1)]++;
        } else if(a != 0 && b == 0) {
            cnt[make_pair(1, 0)]++;
        } else {
            ll g = gcd(abs(a), abs(b));
            ll sig = sign(a * b);
            cnt[make_pair(sig * abs(a) / g, abs(b) / g)]++;
        }
    }
*/
    for ( long long int i = 0; i < n; i++ ) {
        long long int a, b;
        cin >> a >> b;
        if ( a == 0 && b == 0 ) {
            cnt[ make_pair( 0, 0 ) ]++;
            continue;
        } else if ( a != 0 && b == 0 ) {
            cnt[ make_pair( 1, 0 ) ]++;
            continue;
        } else if ( a == 0 && b != 0 ) {
            cnt[ make_pair( 0, 1 ) ]++;
            continue;
        }
        if ( a < 0 ) {
            a *= -1;
            b *= -1;
        }
        if ( a == 0 && b < 0 ) b *= -1;
        long long int g = gcd( a, b );
        a /= g;
        b /= g;
        cnt[ make_pair( a, b ) ]++;
    }
/*
    ll ans = 1;
    for(auto e : cnt) {
        if(e.second == 0) {
            continue;
        }
        if(e.first == make_pair(0LL, 0LL)) {
            continue;
        }
        pair<ll,ll> ort;
        if(e.first == make_pair(0LL, 1LL)) {
            ort = make_pair(1, 0);
        } else if(e.first == make_pair(1LL, 0LL)) {
            ort = make_pair(0, 1);
        } else {
            ort = make_pair(-sign(e.first.first) * abs(e.first.second),
                            abs(e.first.first));
            ;
        }
        ll ppp = modpow(2, e.second) + modpow(2, cnt[ort]) - 1;
        if ( ppp < 0 ) ppp += MOD;
        ppp %= MOD;
        ans *= ppp;
        ans %= MOD;
        cnt[ort] = 0;
        cnt[e.first] = 0;
    }
*/
    long long int ccc = n - cnt[make_pair(0LL, 0LL)];
    long long int ans = 1;
    for ( auto it = cnt.begin(); it != cnt.end(); ++it ) {
        long long int dx = (*it).first.first;
        long long int dy = (*it).first.second;
        long long int p = (*it).second;
        if ( p == 0 ) continue;
        if ( dx == 0 && dy == 0 ) continue;

        long long int ddx = dy;
        long long int ddy = -dx;
        if ( ddx < 0 ) {
            ddx *= -1;
            ddy *= -1;
        }
        if ( ddx == 0 && ddy < 0 ) ddy *= -1;
        long long int q = cnt[ make_pair( ddx, ddy ) ];
        if ( q == 0 ) continue;

        long long int cp = 1;
        for ( long long int i = 0; i < p; i++ ) {
            cp *= 2;
            cp %= MOD;
        }
        long long int cq = 1;
        for ( long long int i = 0; i < q; i++ ) {
            cq *= 2;
            cq %= MOD;
        }
//        cout << " " << p << " " << cp << " " << q << " " << cq << endl;
        ans *= ( cp + cq - 1 );
        ans %= MOD;
        ccc -= p + q;

        (*it).second = 0;
        cnt[ make_pair( ddx, ddy ) ] = 0;

    }

    for ( long long int i = 0; i < ccc; i++ ) {
        ans *= 2;
        ans %= MOD;
    }

    cout << (cnt[make_pair(0, 0)] + ans - 1 + MOD) % MOD << endl;

}


Measured memory_bytes: 28428