#include <bits/stdc++.h>

using namespace std;

#define int long long

const int mod = 1e9 + 7;
const int DIM = 2e5 + 7;

int x[DIM];
int y[DIM];
int power[DIM];

map <pair <int, int>, int> H;

void solve()
{
    int n;
    cin >> n;

    power[0] = 1;

    for(int i = 1; i <= n; ++i)
        power[i] = (power[i - 1] * 2) % mod;

    for(int i = 1; i <= n; ++i)
    {
        cin >> x[i] >> y[i];

        if(x[i] == 0)
        {
            y[i] = 1;
        }
        else
            if(y[i] == 0)
            {
                x[i] = 1;
            }

        int a = x[i], b = y[i];


        if(a < 0)
            a = -a;

        if(b < 0)
            b = -b;

        int p = __gcd(a, b);

        x[i] /= p;
        y[i] /= p;

        if(y[i] < 0)
        {
            x[i] *= -1;
            y[i] = -y[i];
        }

        ++H[{x[i], y[i]}];
    }

    int ans = 1;

    for(auto i : H)
    {
        pair <int, int> t = i.first;

        int p1 = t.first;
        int p2 = t.second;

        pair <int, int> opus = {p2, p1};

        opus.first *= -1;

        if(p1 < 0)
        {
            opus.first *= -1;
            opus.second *= -1;
        }

        if(H.find(opus) == H.end())
        {
            ans = (ans * 1LL * power[i.second]) % mod;
        }
        else
        {
            if(p1 >= 0)
            {
                ans = (ans * ((power[i.second] + power[H[opus]] - 1) % mod)) % mod;
            }
        }
    }

    --ans;
    ans %= mod;

    if(ans < 0)
        ans += mod;

    cout << ans << '\n';
}

main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int t;
    t = 1;

    //cin >> t;

    for(; t; --t)
        solve();
}
