#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007
#define deb(x) cerr << "\n" \
                    << #x << "=" << x << "\n";
#define deb2(x, y) cerr << "\n"                   \
                        << #x << "=" << x << "\n" \
                        << #y << "=" << y << "\n";
#define w(x)  \
    int x;    \
    cin >> x; \
    while (x--)

int n;
const int N = 2e5 + 1;
int a[N], b[N];

int pwmd(int n, int m)
{
    int res = 1;
    while (m > 0)
    {
        if (m & 1)
            res = (res % mod * n % mod) % mod;
        m /= 2;
        n = (n % mod * n % mod) % mod;
    }
    return res;
}

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

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

    map<pair<int, int>, int> m;
    int total = 1;
    int zero = 0;

    for (int i = 0; i < n; i++)
    {
        if (a[i] == 0 && b[i] == 0)
            zero++;
        else
        {
            int g = __gcd(abs(a[i]), abs(b[i]));
            a[i] /= g;
            b[i] /= g;
        }
        m[{a[i], b[i]}]++;
    }

    for (auto i : m)
    {
        if (i.second == 0 || (i.first.first == 0 && i.first.second == 0))
            continue;
        int a = i.first.first;
        int b = i.first.second;
        int v = i.second;

        int v2 = 0;
        if ((a >= 0 && b >= 0) || (a < 0 && b < 0))
        {
            v2 += m[{-b, a}];
            v2 += m[{b, -a}];
            m[{-b, a}] = m[{b, -a}] = 0;
        }
        else
        {
            v2 += m[{max(-b, b), max(a, -a)}];
            v2 += m[{min(a, -a), min(b, -b)}];
            m[{max(-b, b), max(a, -a)}] = m[{min(a, -a), min(b, -b)}] = 0;
        }

        total = total * (pwmd(2, v) + pwmd(2, v2) - 1) % mod;
    }
    cout << (total + zero - 1 + mod) % mod;
    return 0;
}
