#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;

int sign(long long x) {
    return (x > 0) ? +1 : -1;
}

void normalize(pair<long long, long long> &p) {
    long long g = __gcd(p.first, p.second);
    p.first /= g;
    p.second /= g;

    if(p.first == 0) {
        p.second = 1;
    }

    if(p.second == 0) {
        p.first = -1;
    }

    if(sign(p.first) * sign(p.second) > 0) {
        if(p.first < 0) {
            p.first *= -1;
            p.second *= -1;
        }
    } else {
        if(p.first > 0) {
            p.first *= -1;
            p.second *= -1;
        }
    }
}

long long quickPow(long long a, long long b) {
    if(b == 0)
        return 1;

    long long ans = quickPow(a, b / 2);

    ans = (ans * ans) % MOD;
    if(b % 2)
        ans = (ans * a) % MOD;

    return ans;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;  cin >> n;
    vector<pair<long long, long long> > a(n);

    for(auto &val : a)  cin >> val.first >> val.second;

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

    for(auto val : a) {
        if(val == make_pair(0LL, 0LL))
            continue;
        normalize(val);
        mp[val]++;
    }

    long long ans = 1;

    for(auto link : mp) {
        auto vect = link.first;
        long long cnt = link.second;

        if(cnt == 0)
            continue;

        decltype(vect) perp = {vect.second, -vect.first};

        if(mp[perp] > 0) {
            long long a = cnt;
            long long b = mp[perp];
            long long mult = ((quickPow(2, a) + quickPow(2, b)) % MOD);
            mult = (((mult - 1) % MOD) + MOD) % MOD;
            ans = (ans * mult) % MOD;
            //cerr << "!!! " << vect.first << ' ' << vect.second << ' ' << mult << '\n';
            mp[perp] = 0;
        } else {
            //cerr << vect.first << ' ' << vect.second << ' ' << quickPow(2, cnt) << '\n';
            ans = (ans * quickPow(2, cnt)) % MOD;
        }
    }

    ans = (((ans - 1) % MOD) + MOD) % MOD;

    cout << ans << '\n';

    return 0;
}
