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

typedef int64_t Int;
#define all(x) (x).begin(), (x).end()
 
const double EPS = 1e-10;
const Int INF = 1e18;
const int inf = 1e9;
const Int mod = 1e9+7;

bool print_space_enable = false;
void print() { 
    cout << endl; 
    print_space_enable = false;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
    if (print_space_enable) cout << " ";
    cout << fixed << setprecision(15) << head;
    print_space_enable = true;
    print(std::forward<Tail>(tail)...);
}

template<typename T>
void print(vector<T> v) {
    for (size_t i = 0; i < v.size(); i++) {
        if (i > 0) std::cout << " ";
        std::cout << v[i];
    }
    std::cout << std::endl;
}

Int bp[200001];

int main() {
    Int n;
    cin >> n;
    vector<Int> a(n), b(n);
    Int dz, az, bz;
    dz = az = bz = 0;
    for (Int i = 0; i < (Int)n; i++) {
        cin >> a[i] >> b[i];
        assert(a[i] != 0 or a[i] != 0);
        if (a[i] == 0 and b[i] == 0) {
            dz++;
            continue;
        }
        if (a[i] == 0) {
            az++;
            continue;
        }
        if (b[i] == 0) {
            bz++;
            continue;
        }
        Int x = gcd(abs(a[i]), abs(b[i]));
        a[i] /= x;
        b[i] /= x;
    }
    bp[0] = 1;
    for (Int i = 0; i < (Int)n; i++) {
        bp[i + 1] = bp[i] * 2LL % mod;
    }
    map<pair<Int, Int>, Int> mp;
    for (Int i = 0; i < (Int)n; i++) {
        if (a[i] == 0 or b[i] == 0) continue;
        mp[{a[i], b[i]}]++;
    }
    Int other = 0;
    for (auto i : mp) {
        pair<Int, Int> p = i.first;
        if (p.first == 0 or p.second == 0) continue;
        if (mp[{p.second, -p.first}] == 0 and mp[{-p.second, p.first}] == 0) {
            other += mp[p];
            mp[p] = 0;
            //print(p.first, p.second);
        }
    }
    Int res = bp[other];
    if (dz > 0) {
        res = (res + 1) % mod;
    }
    Int adda = 0, addb = 0;
    if (az > 0) {
        adda = res * bp[az] % mod;
    }
    if (bz > 0) {
        addb = res * bp[bz] % mod;
    }
    if (az > 0 and bz > 0) {
        res = (adda + addb - res + mod) % mod;
    } else if (az > 0) {
        res = adda;
    } else if (bz > 0) {
        res = addb;
    }
    for (auto i : mp) {
        if (i.second == 0) continue;
        pair<Int, Int> p = i.first;
        //print(p.first, p.second);
        Int x = i.second + mp[{-p.first, -p.second}];
        Int y = mp[{p.second, -p.first}] + mp[{-p.second, p.first}];
        //print(x, y);
        Int aa = res * bp[x] % mod;
        Int bb = res * bp[y] % mod;
        res = (aa + bb - res + mod) % mod;
        mp[p] = mp[{-p.first, -p.second}] = mp[{p.second, -p.first}] = mp[{-p.second, p.first}] = 0;
    }
    print(res - 1);
    return 0;
}