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

const long long MOD = 1000000007;

typedef long long ll;

void solve(long long N, std::vector<long long> A, std::vector<long long> B){
    for (int i = 0; i < N; i++) {
        if (A[i] == 0 && B[i] == 0) continue;
        if (A[i] == 0) {
            B[i] = 1;
            continue;
        }
        if (B[i] == 0) {
            A[i] = 1;
            continue;
        }
        long long g = gcd(A[i], B[i]);
        g = A[i] < 0 ? -g : g;
        A[i] /= g;
        B[i] /= g;
    }

    unordered_map<string, long long> counts;
    for (int i = 0; i < N; i++) {
        string s = to_string(A[i]) + "*" + to_string(B[i]);
        counts[s]++;
    }

    unordered_map<string, bool> used;
    long long result = 1;
    for (long long i = 0; i < N; i++) {
        if (A[i] == 0 && B[i] == 0) {
            continue;
        }
        long long b = B[i] < 0 ? -B[i] : B[i];
        long long a = B[i] < 0 ? -A[i] : A[i];
        string s1 = to_string(b) + "*" + to_string(b == 0 ? 1 : -a);
        string s2 = to_string(A[i]) + "*" + to_string(B[i]);
        if (used[s1]) continue;
        used[s1] = true;
        used[s2] = true;
        long long c1 = counts[s1];
        long long c2 = counts[s2];

        long long n = 0;
        long long res = 1;
        while (c1--) {
            res *= 2;
            res %= MOD;
        }
        n += res-1;

        res = 1;
        while (c2--) {
            res *= 2;
            res %= MOD;
        }
        n += res;
        n %= MOD;

        // cout << n << endl;
        result *= n;
        n %= MOD;
    }
    result += counts["0*0"];
    result %= MOD;
    cout << ((result-1) % MOD) << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    std::vector<long long> B(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
        scanf("%lld",&B[i]);
    }
    solve(N, std::move(A), std::move(B));
    return 0;
}
