#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pi = pair<int, int>;

ll gcd(ll a, ll b)
{
    if (a % b == 0)
        return (b);
    else
        return (gcd(b, a % b));
}

int main()
{
    int n;
    ll mod = 1000000007;
    cin >> n;
    ll x, y, zero = 0;
    map<pair<ll, ll>, pi> iwashi;
    for (int i = 0; i < n; i++)
    {
        cin >> x >> y;
        if (x == 0 && y == 0)
        {
            zero++;
            continue;
        }
        ll g = gcd(x, y);
        x /= g;
        y /= g;
        if (y < 0)
            x = -x, y = -y;
        else if (y == 0 && x < 0)
            x = -x, y = -y;
        bool rot90 = (x <= 0);
        if (rot90)
        {
            ll tmp = x;
            x = y, y = -tmp;
        }
        if (rot90)
            iwashi[{x, y}].first++;
        else
            iwashi[{x, y}].second++;
    }

    ll ans = 1;
    for (auto p : iwashi)
    {
        int s = p.second.first;
        int t = p.second.second;
        ll now = 1; //誰も選ばない
        now += pow(2, s) - 1;
        now += pow(2, t) - 1;
        pow %= mod;
        ans *= now;
        ans %= mod;
    }
    ans--;
    ans += zero;
    cout << ans << endl;
}
