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

long long const mod = 1000000007;

long long powmod(long long x, long long n) {
    long long ret = 1;
    while(n > 0) {
        if(n & 1) ret = ret * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return ret;
}

using pp = pair<long long, long long>;

int main() {
    int N; cin >> N;
    map<pp, pp> R;
    int A = 0, B = 0, C = 0;
    for(int i=0; i<N; ++i) {
        long long a, b; cin >> a >> b;
        if(a == 0 && b == 0) ++C;
        else if(a == 0) ++A;
        else if(b == 0) ++B;
        else {
            bool neg = false;
            if(a > 0 && b < 0) {
                b *= -1;
                swap(a, b);
                neg = true;
            } else if(a < 0 && b > 0) {
                a *= -1;
                swap(a, b);
                neg = true;
            }
            long long g = gcd(a, b);
            a /= g; b /= g;
            if(neg) R[pp(a, b)].second += 1;
            else R[pp(a, b)].first += 1;
        }
    }

    long long cnt = 1;
    for(auto tmp : R) {
        auto [x, y] = tmp.second;
        cnt = cnt * ((powmod(2, x) + powmod(2, y) - 1) % mod) % mod;
    }

    long long res = 0;
    if(A) cnt * powmod(2, A) % mod;
    if(B) res = (res + cnt * powmod(2, B)) % mod;
    if(A == 0 && B == 0) res = cnt;
    res -= 1;
    res = (res + C) % mod;
    cout << res << '\n';
}