#include <bits/stdc++.h>
#define int long long

using namespace std;
typedef pair <int, int> ii;

const int mod = 1e9 + 7;
int n;
int a[200001], b[200001];
map <ii, int> v;

int quickPow(int base, int p)
{
    if (p == 0) return 1;
    int x = quickPow(base, p / 2);
    if (p % 2 == 0) return x * x;
    return x * x * base;
}

int getSum(int x, int y)
{
    int mul = (quickPow(2, x) % mod + quickPow(2, y) % mod) % mod;
    mul = ((mul - 1) % mod + mod) % mod;
    return mul;
}

int cal(ii x, ii y)
{
    int t = getSum(v[x], v[y]);
//    cerr << "   t: " << t << '\n';
    return t;
}

int32_t main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
//    freopen("INP.INP", "r", stdin);
//    freopen("OUT.OUT", "w", stdout);
    cin >> n;
    int cnt0 = 0;
    for (int i = 1; i <= n; i++) {
        cin >> a[i] >> b[i];
        if (a[i] == 0 && b[i] == 0) cnt0++;
        if (b[i] < 0) {
            a[i] = -a[i];
            b[i] = -b[i];
        }
        if (a[i] == 0 && b[i] != 0) b[i] = 1;
        if (a[i] != 0 && b[i] == 0) a[i] = 1;
    }

    for (int i = 1; i <= n; i++) {
        if (a[i] == 0 && b[i] == 0) continue;
        int g = __gcd(a[i], b[i]);
        a[i] /= g;
        b[i] /= g;
        v[ii(a[i], b[i])]++;
    }
    int ans = 1;
    for (int i = 1; i <= n; i++) {
        ii base = ii(a[i], b[i]);
        ii ab1 = ii(-b[i], a[i]);
        ii ab2 = ii(b[i], -a[i]);
//        cerr << "base: " << a[i] << " " << b[i] << " " << v[base] << '\n';
//        cerr << "ab1: " << -b[i] << " " << a[i] << " " << v[ab1] << '\n';
//        cerr << "ab2: " << b[i] << " " << -a[i] << " " << v[ab2] << '\n' << '\n';
        if (v[ab1] == 0 && v[ab2] == 0) {
            ans = (ans * (quickPow(2, v[base])) % mod) % mod;
            v[base] = 0;
            continue;
        }
        if (v[ab1] != 0) {
            ans = (ans * cal(base, ab1));
            v[ab1] = 0;
        }
        if (v[ab2] != 0) {
            ans = (ans * cal(base, ab2));
            v[ab2] = 0;
        }
        v[base] = 0;
    }
    ans = (((ans - 1) % mod) + mod) % mod;
    ans = (ans + cnt0) % mod;
    cout << ans;
    return 0;
}
