#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int MD = 1e9 + 7;
map<pair<ll, ll>, int> ma;
set<pair<ll, ll>> vis;
int quick_pow(int x, int y) {
    int ans = 1;
    while(y) {
        if(y & 1) ans = 1LL * ans * x % MD;
        y >>= 1;
        x = 1LL * x * x % MD;
    }
    return ans;
}
int main() {
    int n, s = 0, s1 = 0, s2 = 0;
    scanf("%d", &n);
    for(int i = 0; i < n; i++) {
        ll a, b;
        scanf("%lld%lld", &a, &b);
        if(a < 0) a = -a, b = -b;
        if(a == 0 && b == 0) {
            s++;
            continue;
        }else if(a == 0) {
            s1++;
            continue;
        }else if(b == 0) {
            s2++;
            continue;
        }
        ll t = __gcd(a, abs(b));
        a /= t, b /= t;
        ma[{a, b}]++;
    }
    ll ans = (quick_pow(2, s1) + quick_pow(2, s2) - 1 + MD) % MD;
    for(auto it : ma) {
        if(vis.find(it.first) != vis.end()) continue;
        ll a = it.first.first, b = it.first.second;
        b = -b;
        if(b < 0) b = -b, a = -a;
        int c = it.second;
        if(!ma.count({b, a})) {
            ans = ans * quick_pow(2, c) % MD;
        }else {
            ans = ans * (quick_pow(2, c) + quick_pow(2, ma[{b, a}]) - 1 + MD) % MD;
            vis.insert({b, a});
        }
    }
    ans = (ans - 1 + s + MD) % MD;
    printf("%lld\n", ans);
    return 0;
}