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

const int N = 2e5 + 7;
const int mod = 1e9 + 7;

int bad[N];

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    bad[0] = 1;
    for (int i = 1; i < 2e5 + 7; i++) {
        bad[i] = (bad[i - 1] * (ll) 2) % mod;
    }
    int n;
    cin >> n;
    vector <ll> a(n), b(n);
    map <pair <int, int>, int> c;    
    int bruh = 0;
    int fx = 0, fy = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i] >> b[i];
        if (a[i] == 0 && b[i] == 0) {
            bruh++;
            continue;
        }
        if (!a[i]) {
            fx++;
            continue;
        }
        if (!b[i]) {
            fy++;
            continue;
        }
        ll x = abs(a[i]), y = abs(b[i]);
        ll g = __gcd(x, y);
        x /= g;
        y /= g;
        if ((a[i] > 0 && b[i] > 0) || (a[i] < 0 && b[i] < 0)) {
            c[{x, y}]++;
        } else {
            c[{-x, y}]++;
        }
    }
    vector <pair <int, int> > sad;
    int ans = 0;
    auto add = [&] (int &ans, int x) {
        ans += x;
        if (ans >= mod) ans -= mod;
        if (ans < 0) ans += mod;
    };
    add(ans, bad[bruh]);
    sad.push_back({fx, fy});
    for (auto to : c) {
        if (to.second) {
            int x = to.first.first;
            int y = to.first.second;
            int orz = 1;
            if (x < 0) orz = -1;
            x = abs(x);        
            pair <int, int> rofl = {-y * orz, x};
            sad.push_back({to.second, c[rofl]});
            c[rofl] = 0;
        }
    }
    auto mul = [&] (int x, int y) {
        return (x * (ll) y) % mod;
    };
    for (auto to : sad) {
        int cur = 0;
        add(cur, bad[to.first]);
        add(cur, bad[to.second]);
        add(cur, -1);
        ans = mul(ans, cur);
    }
    add(ans, -1);
    cout << ans << '\n';
    return 0;
}