#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <numeric>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);

ll power(ll x, ll y)
{
    ll ans = 1;
    while (y)
    {
        if (y & 1)
            ans = (ans * x) % MOD;
        x = (x * x) % MOD;
        y >>= 1;
    }
    return ans;
}

int main(void)
{
    ll n;

    cin >> n;

    vector<ll> a(n), b(n);

    map<P, ll> m;
    ll ans = 1;

    for (int i = 0; i < n; i++)
    {
        cin >> a[i] >> b[i];

        if (a[i] == 0 && b[i] == 0)
        {
            m[P(0, 0)]++;
        }
        else if (a[i] == 0)
        {
            m[{0, -1}]++;
        }
        else if (b[i] == 0)
        {
            m[{1, 0}]++;
        }
        else
        {
            ll g = gcd(a[i], b[i]);

            if (a[i] < 0)
            {
                a[i] *= -1;
                b[i] *= -1;
            }

            m[{a[i] / g, b[i] / g}]++;
        }
    }

    set<P> s;

    for (auto p : m)
    {
        if (s.find(p.first) != s.end())
        {
            continue;
        }

        if (p.first != P(0, 0))
        {
            if (p.first.second < 0)
            {
                s.insert({-p.first.second, p.first.first});
            }
            else
            {
                s.insert({p.first.second, -p.first.first});
            }
        }

        ll x = p.second, y;

        if (p.first.second < 0)
        {
            y = m[{-p.first.second, p.first.first}];
        }
        else
        {
            y = m[{p.first.second, -p.first.first}];
        }

        if (p.first == P(0, 0))
        {
            ans *= (m[{0, 0}] + 1);
            ans %= MOD;
        }
        else if (y == 0)
        {
            ans *= power(2, x);
            ans %= MOD;
        }
        else
        {
            ans *= ((power(2, x) + power(2, y) - 1)) % MOD;
            ans %= MOD;
        }

        ans %= MOD;
    }

    ans = (ans - 1 + MOD) % MOD;

    cout << ans << endl;
}
