#include <bits/stdc++.h>
using namespace std;
const int N = 200000 + 10;
const int p = 1000000000 + 7;

long long gcd(long long a, long long b) {return !b ? a : gcd(b, a % b); }

void Change(long long &x, long long &y) {
    if (x < 0)  { x = -x; y = -y; }
    if (x == 0 && y < 0)    {y = -y; }
}

long long qpow(long long a, long long k = p - 2) {
    long long res = 1;
    while (k) {
        if (k & 1)  res = res * a % p;
        a = a * a % p;
        k >>= 1;
    }
    return res;
}

int n;
map <pair<long long, long long>, int> mp;

int main() {
    scanf("%d", &n);
    long long ans = 0, tans = 1;
    for (int i = 1; i <= n; i++) {
        long long x, y; scanf("%lld %lld", &x, &y);
        long long d = gcd(abs(x), abs(y));
        x /= d; y /= d;
        Change(x, y);
        pair<long long, long long> a = {x, y};
        swap(x, y); y = -y;

        Change(x, y);
        pair<long long, long long> b = {x, y};
        
        tans = tans * qpow(qpow(2, mp[a]) + qpow(2, mp[b]) - 1)) % p;
        tans = tans * qpow(2, mp[a]) % p;
        ans = (ans + tans) % p;
        tans = tans * qpow(qpow(2, mp[a])) % p;
        mp[a]++;
        tans = tans * (qpow(2, mp[a]) + qpow(2, mp[b]) - 1) % p;
    }
    printf("%lld\n", ans);
#ifndef ONLINE_JUDGE
    system("pause");
#endif
    return 0;
}