#include <bits/stdc++.h>
#define mod 1000000007

using namespace std;
typedef long long ll;
typedef long double ld;

map< pair<ll, ll>, ll>m;
map< pair<ll, ll>, bool>used;

ll elev(ll b, ll e){

    if(!e)
     return  1ll;
    if(e&1)
     return (b*elev(b, e-1ll))%mod;

    ll x = elev(b, e>>1ll);
    return (x*x)%mod;
}

int main()
{ 
    ios_base::sync_with_stdio(0); cin.tie(0);
    int n;

    cin >> n;
    ll x, y;

    ll x0, y0, p0;
    x0 = y0 = p0 = 0;

    for(int i = 1; i <= n; i++){

     cin >> x >> y;
     if(x == y && x == 0)
        p0++;
     else if(x == 0)
        x0++;
     else if(y == 0)
        y0++;
     else {

        if(y < 0)
            x *= -1, y *= -1;

        ll gcd = __gcd(x, y);
        x /= gcd;
        y /= gcd;
        m[{x, y}]++;
     }
    }
    ll sol = (elev(2ll, x0) + elev(2ll, y0) - 1 + mod )%mod;

    for(auto i : m){

        if(used[i.first])
         continue;
       
       used[i.first] = 1;
        pair<ll, ll>ortog;
        ortog = {-i.first.second, i.first.first};

        if(ortog.second < 0)
          ortog.first*=-1, ortog.second *= -1;

        y = 0;
        if(m.count(ortog))
            y = m[ortog],
            used[ortog] = true;

        y = (elev(2ll, y) - 1+mod)%mod;
        x = (elev(2ll, i.second) - 1+mod)%mod;

        sol = (sol*((x + y + 1)%mod))%mod;
    }
    cout << (sol + p0 - 1 + mod)%mod;
    return 0;
}
