#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

const ll MOD = 1000000007;

int mod_pow(int x, int n)
{
    if (n == 0)
        return 1;
    int res = mod_pow(x * x % MOD, n / 2);
    if (n & 1)
        res = res * x % MOD;
    return res;
}

int N;
ll A[201010], B[201010];

pair<ll, ll> rev(pair<ll, ll> x)
{
    ll a = -x.first;
    ll b = x.second;

    if (a < 0)
        return make_pair(-b, -a);
    return make_pair(b, a);
}

int main()
{
    cin >> N;
    for (int i = 0; i < N; i++)
    {
        cin >> A[i] >> B[i];
    }

    int zero_zero = 0;
    int zero_no = 0;
    int no_zero = 0;
    map<pair<ll, ll>, int> cnt;

    for (int i = 0; i < N; i++)
    {
        if (A[i] == 0 && B[i] == 0)
        {
            zero_zero++;
        }
        else if (A[i] == 0)
        {
            zero_no++;
        }
        else if (B[i] == 0)
        {
            no_zero++;
        }
        else
        {
            ll g = __gcd(abs(A[i]), abs(B[i]));
            A[i] /= g;
            B[i] /= g;
            if (B[i] < 0)
            {
                A[i] *= -1;
                B[i] *= -1;
            }
            cnt[make_pair(A[i], B[i])]++;
        }
    }

    int ans = (mod_pow(2, zero_no) + mod_pow(2, no_zero)) % MOD - 1;
    set<pair<ll, ll>> used;
    for (auto cn : cnt)
    {
        if (!used.count(cn.first))
        {
            auto p = cn.first;
            auto pp = rev(p);
            if (cnt.count(pp))
            {
                int tmp = (mod_pow(2, cnt[p]) + mod_pow(2, cnt[pp])) % MOD - 1;
                ans = (ans * tmp) % MOD;
                used.insert(pp);
            }
            else
            {
                int tmp = mod_pow(2, cnt[p]);
                ans = (ans * tmp) % MOD;
            }
        }
    }

    ans = (ans + zero_zero) % MOD;
    ans -= 1;
    cout << ans << endl;
    return 0;
}