#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using P = pair<ll, ll>;

constexpr char newl = '\n';

const ll MOD = 1000000007;

ll modpow(ll x, ll n, ll mod = MOD) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}

P hoge(ll a, ll b) {
    if (a == 0) return P(0, 1);
    else if (b == 0) return P(1, 0);

    ll g;
    if (a < 0 && b < 0) {
        a = -a;
        b = -b;
        g = __gcd(a, b);
    } else if (a < 0 || b < 0) {
        a = -abs(a);
        b = abs(b);
        g = __gcd(-a, b);
    } else {
        g = __gcd(a, b);
    }

    a /= g;
    b /= g;    
    return P(a, b);
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;

    map<P, int> memo;
    for (int i = 0; i < n; i++) {
        ll a, b;
        cin >> a >> b;

        if (a == 0 && b == 0) continue;

        memo[hoge(a, b)]++;
    }
    
    ll ans = 1;
    set<P> s2;
    for (auto p : memo) {
        if (s2.find(p.first) != s2.end()) continue;
        P p2 = hoge(-p.first.second, p.first.first);
        int foo = (memo.find(p2) == memo.end() ? 0 : memo[p2]);
        (ans *= (modpow(2, p.second) + modpow(2, foo) + MOD - 1) % MOD) %= MOD;
        s2.insert(p2);
    }
    ans = (ans + MOD - 1) % MOD;
    cout << ans << newl;
    return 0;
}