#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 getMul(ii base, ii to)
{
    int x = v[base], y = v[to];
    int i = quickPow(2, x), j = quickPow(2, y);
    return ((quickPow(2, x) % mod + quickPow(2, y) % mod - 1 + mod * mod) % mod);
}

int cal(int x, int y)
{
    ii tmp = ii(x, y);
    int sum = quickPow(2, v[tmp]);
//    cerr << "sum: " << sum << '\n';
    if (x > 0 && v[ii(-y, x)] > 0) {
//        cerr << "   1" << '\n';
        sum = ((sum + quickPow(2, v[ii(-y, x)])) % mod - 1 + mod * mod) % mod;
        v[ii(-y, x)] = 0;
    }
//    cerr << "sum1: " << sum << '\n';
    if (x < 0 && v[ii(y, -x)] > 0) {
//        cerr << "   2" << '\n';
        sum = ((sum + quickPow(2, v[ii(y, -x)])) % mod - 1 + mod * mod) % mod;
        v[ii(y, -x)] = 0;
    }
//    cerr << "sum2: " << sum << '\n' << '\n';
    v[tmp] = 0;
    return sum;
}

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;
    for (int i = 1; i <= n; i++) {
        cin >> a[i] >> b[i];
        if (b[i] < 0) {
            a[i] = -a[i];
            b[i] = -b[i];
        }
    }
    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])] = 0;
        if (a > 0)
            v[ii(-b[i], a[i])] = 0;
        if (a < 0)
            v[ii(b[i], -a[i])] = 0;
        if (a == 0) {
            v[ii(-b[i], a[i])] = 0;
            v[ii(b[i], -a[i])] = 0;
        }
    }
    for (int i = 1; i <= n; i++)
        v[ii(a[i], b[i])]++;
    int ans = 1;
    for (int i = 1; i <= n; i++) {
        if (a[i] == 0 && b[i] == 0) continue;
        if (v[ii(a[i], b[i])] > 0)
            ans = (ans * cal(a[i], b[i])) % mod;
    }
//    cerr << "ans: " << ans << '\n';
    ans = (ans - 1) % mod;
    cout << ans;
    return 0;
}
