#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

const int mod = 1e9 + 7;
    

long long int mypow(long long int a, long long int b) {
    if (b == 0) return 1;
    if (b == 1) return a;
    long long int res = mypow(a, b / 2);
    res = res * res % mod;
    if (b % 2 == 1) res = res * a % mod;
    return res;
}

int main() {
    int n;
    cin >> n;
    int two_zero = 0;
    int left_zero = 0, right_zero = 0;
    unordered_map<long long int, unordered_map<long long int, long long int>> um;
    for (int i = 0; i < n; i++) {
        long long int a, b;
        cin >> a >> b;
        if (a == 0 && b == 0) {
            two_zero++;
            continue;
        }
        if (a == 0) {
            left_zero++;
            continue;
        }
        if (b == 0) {
            right_zero++;
            continue;
        }
        long long int c = gcd(a, b);
        a /= c;
        b /= c;
        if (a < 0) {
            a = -a;
            b = -b;
        }
        um[a][b]++;
    }
    vector<long long int> v;
    for (auto p1 : um) {
        for (auto p2 : p1.second) {
            long long int a = p1.first, b = p2.first;
            long long int c = um[a][b];
            if (c == 0 || a == 0 || b == 0) continue;
            long long int next_a = abs(b), next_b = a;
            if (b < 0) 
                next_b = a; 
            else 
                next_b = -a;
            if (um[next_a].find(next_b) == um[next_a].end()) {
                v.push_back(mypow(2, c));
            } else {
                v.push_back((mypow(2, c) + mypow(2, um[next_a][next_b]) - 1) % mod);
                um[next_a][next_b] = 0;
            }
            um[a][b] = 0;
        }
    }
    if (um.size() == 0 && left_zero == 0 && right_zero == 0) {
        cout << n << endl;
        return 0;
    }

    long long int res = (mypow(2, left_zero) + mypow(2, right_zero) - 1) % mod;
    for (auto num : v) {
        res = res * num % mod;
    }
    res += two_zero;
    res--;
    res += mod;
    res %= mod;
    cout << res << endl;
}
