#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <numeric>
#include <chrono>
#include <bitset>
#include <tuple>
#include <queue>
#include <map>
#include <cstring>
#include <cassert>
#include <math.h>
using namespace std;

const int N = 2e5 + 10, mod = 1e9 + 7;

int fp(int a, int b) {
    int ret = 1;
    while(b) {
        if(b & 1) ret = 1ll * ret * a % mod;
        b >>= 1;
        a = 1ll * a * a % mod;
    }
    return ret;
}

using ll = long long;
pair<ll, ll> get(pair<ll, ll> t) {
    if(!t.first || !t.second) return {t.second, t.first};
    int sign = (t.first < 0 ? 1 : 0);
    return {(sign ? 1 : -1) * t.second, abs(t.first)};
}

int main() {
    // ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int tc = 1; 
    // scanf("%d", &tc);
    for(int cn = 1; cn <= tc; cn++) {
        int n; scanf("%d", &n);
        vector<long long> a(n), b(n);
        for(int i = 0; i < n; i++) scanf("%lld%lld", &a[i], &b[i]);
        map<pair<ll, ll>, int> cnt, vis;
        int ans = 0;
        for(int i = 0; i < n; i++) {
            if(!a[i] && !b[i]) {
                ans++;
                continue;
            }
            if(!a[i]) b[i] = 1;
            if(!b[i]) a[i] = 1;
            int sign = (a[i] < 0 ^ b[i] < 0 ? 1 : 0);
            a[i] = abs(a[i]), b[i] = abs(b[i]);
            ll g = __gcd(a[i], b[i]);
            pair<ll, ll> t = {(sign ? -1 : 1) * a[i] / g, b[i] / g};
            cnt[t]++;
        }
        for(auto x : cnt) {
            pair<ll, ll> t = x.first;
            if(vis[t]) continue;
            // cout << t.first << ' ' << t.second << 
            // ' '  << x.second << ' ' << cnt[get(t)] << '\n';
            int cur = fp(2, x.second);
            cur = (1ll * cur + fp(2, cnt[get(t)])) % mod;
            cur = (1ll * cur - 1) % mod;
            // cout << cur << '\n';
            if(!ans) ans = cur;
            else ans = 1ll * ans * cur % mod;
            vis[get(t)] = 1;
        }
        ans = (ans - 1ll) % mod;
        if(ans < 0) ans += mod;
        printf("%d\n", ans);
    }  
    return 0;
}