#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
typedef long long ll;
const ll Mod = 1e9 + 7;
ll power(ll y) {
    ll res = 1LL;
    ll x = 2LL;
    while (y > 0) {
        if (y & 1)
            res = (res * x) % Mod;
        y = y >> 1;  // y = y/2
        x = (x * x) % Mod;
    }
    return res;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(9);
    int n;
    cin >> n;
    // map<double, pair<int, int>> mp;
    int special = 0;
    map<pair<int, int>, pair<int, int>> mp;
    for (int i = 0; i < n; i++) {
        // double a, b;
        int a, b;
        cin >> a >> b;
        if (a == 0 && b == 0) {
            special++;
            continue;
        } else if (a == 0) {
            b = 1;
        } else if (b == 0) {
            a = -1;
        } else {
            int g = __gcd(a, b);
            a = a / g, b = b / g;
            if (b < 0)
                a = -a, b = -b;
        }
        pair<int, int> ang = make_pair(a, b);
        pair<int, int> bad = a >= 0 ? make_pair(-b, a) : make_pair(b, -a);
        if (mp.find(bad) != mp.end()) {
            mp[bad].second++;
        } else {
            mp[ang].first++;
        }
    }

    ll ans = 1;
    for (auto& p : mp) {
        // cout << p.first.first << ", " << p.first.second << " : "
        //      << p.second.first << " " << p.second.second << endl;
        if (p.second.second == 0) {
            ans = ans * power(p.second.first) % Mod;
        } else {
            ll c1 = (power(p.second.first) + power(p.second.second) - 1) % Mod;
            // ll c2 = power(p.second.second);
            ans = ans * c1 % Mod;
            // ans = (ans * (c1 + c2 - 1)) % Mod;
        }
    }
    cout << ans - 1 + special << '\n';
}