#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
typedef long long ll;
const int maxn = 200005;
typedef pair<ll, ll>par;
const ll mod = 1000000007;

map< par, int > M;

ll pot( ll b, ll e ){
    ll ret = 1, a = b;
    while( e ){
        if( e & 1 ) ret = (ret * a)%mod;
        a = (a*a)%mod;
        e >>= 1;
    }
    return ret;
}

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    #ifdef acm
    freopen("a.in", "r",stdin);
    #endif // acm

    int n;
    cin >> n;

    ll a, b;
    ll c0 = 0;
    for( int i = 1; i <= n; i++ ){
        cin >> a >> b;
        if( a == 0 && b == 0 ){
            c0++;
            continue;
        }
        if( a < 0 )
            a*= -1, b*=-1;

        ll g = __gcd(abs(a), abs(b));
        a /= g, b /= g;

        M[ par(a, b) ]++;
    }

    ll cant0 = c0;

    ll sol = 1;
    for( auto &i : M ){
        auto p = i.first;
        a = p.fi, b = p.se;
        ll c1 = i.se, c2 = 0;

        ll na = -b, nb = a;
        if( na < 0 )
            na *= -1, nb *= -1;

        if( M.count( par(na, nb) ) ){
            c2 = M[ par(na, nb) ];
            M[ par(na, nb) ] = 0;
        }

        M[ par(a, b) ] = 0;

        sol = sol * (pot(2, c1)-1 + mod + pot(2, c2) - 1 + mod + 1)%mod;
    }

    cout << (sol - 1 + mod + c0)%mod;

    return 0;
}
