#include <bits/stdc++.h>
using namespace std;

#define int long long
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define yn(x) ((x) ? "Yes" : "No")

typedef pair <int, int> ii;
typedef pair <int, ii> iii;

const int siz = 2e5 + 10;
const int SIZ = 1e6 + 10;
const int mod = 1e9 + 7;
const int maxx = 2e9;
const int MAXX = 1e18;
const string file = "1";

int quickPow(int x, int n) {
    if (n == 0) {
        return 1;
    }

    int t = quickPow(x, n / 2);
    (t *= t) %= mod;

    if (n % 2 == 0) {
        return t;
    }
    return (t * x) % mod;
}

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

//    freopen ((file + ".inp").c_str(), "r", stdin);
//    freopen ((file + ".out").c_str(), "w", stdout);

    int n;
    cin >> n;
    map <ii, int> cnt;
    int cnt0 = 0;
    for (int i = 1; i <= n; i++) {
        int x, y;
        cin >> x >> y;

        if (x == 0 && y == 0) {
            cnt0++;
            continue;
        }

        int g = __gcd(abs(x), abs(y));
        x /= g;
        y /= g;

        if (y < 0) {
            x *= (-1);
            y *= (-1);
        }

        if (y == 0) {
            if (x < 0) {
                x *= (-1);
            }
        }

        cnt[ii(x, y)]++;
    }

//    for (auto &a : cnt) {
//        cout << a.fi.fi << " " << a.fi.se << " " << a.se << "\n";
//    }

    int ans = 1;
    for (auto &a : cnt) {
        int x, y;
        tie(x, y) = a.fi;

        if (cnt[ii(x, y)] == -1) {
            continue;
        }

        int x2 = -y, y2 = x;
        if (y2 < 0) {
            x2 *= (-1);
            y2 *= (-1);
        }

        if (y2 == 0) {
            if (x2 < 0) {
                x2 *= (-1);
            }
        }

        if (cnt.find(ii(x2, y2)) != cnt.end()) {
            if (cnt[ii(x2, y2)] != -1) {
                (ans *= ((quickPow(2, cnt[ii(x, y)]) + quickPow(2, cnt[ii(x2, y2)])) % mod - 1)) %= mod;
                cnt[ii(x, y)] = -1;
                cnt[ii(x2, y2)] = -1;
            }
        }
        else {
            (ans = 2LL * ans * cnt[ii(x, y)]) %= mod;
        }
    }

    cout << ((ans - 1 + mod) % mod + cnt0) % mod << "\n";

//    cerr << "Time: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";

    return 0;
}
