#include<bits/stdc++.h>
#define ff first
#define ss second
#define IO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0)
using namespace std;
typedef long long ll;
#define pi acos(-1.00)
const int INF = 1e9 + 5;
const ll mod = 1000000007;
ll power(ll a, ll p){
    if(p == 0) return 1;
    if(p == 1) return a % mod;
    if(p & 1) return a * power(a, p - 1) % mod;
    ll r = power(a, p / 2) % mod;
    return r * r % mod;
}
void add(ll &a, ll b){
    a += b;
    if(a > mod) a -= mod;
    if(a < 0) a += mod;
}
int main() {
    IO;
    int n;
    cin >> n;
    vector<pair<ll, ll> > a(n), b(n);
    for(auto &x: a)
        cin >> x.ff >> x.ss;

    map<pair<ll, ll> , int> mp;
    set<pair<ll, ll> > s;
    for(int i = 0; i < n; i++) {
        if(a[i].ff != 0 || a[i].ss != 0) {
            ll gcd = __gcd(a[i].ff, a[i].ss);
//            cout << gcd << endl;
            a[i].ff /= gcd, a[i].ss /= gcd;
            if (a[i].ss < 0) a[i].ff *= -1, a[i].ss *= -1;
        }
        mp[{a[i].ff, a[i].ss}]++;
        s.insert({a[i].ff, a[i].ss});
    }
    ll ans = 1;

    for(auto x: s){
        if(mp[x] == -1) continue;
        if(x.ff == 0 && x.ss == 0) continue;
        if(x.ff == 0 || x.ss == 0){
            ll val = power(2, mp[{x.ff, x.ss}]);
            add(val, power(2, mp[{x.ss, x.ff}]));
            add(val, -1);
            ans *= val;
            mp[{x.ff, x.ss}] = mp[{x.ss, x.ff}] = -1;
        }
        else{
            if(x.ff < 0) {
                ll val = power(2, mp[{x.ff, x.ss}]);
                add(val, power(2, mp[{x.ss, -x.ff}]));
                add(val, -1);
                ans *= val;
                mp[{x.ff, x.ss}] = mp[{x.ss, -x.ff}] = -1;
            }
            else{
                ll val = power(2, mp[{x.ff, x.ss}]);
                add(val, power(2, mp[{-x.ss, x.ff}]));
                add(val, -1);
                ans *= val;
                mp[{x.ff, x.ss}] = mp[{-x.ss, x.ff}] = -1;
            }
        }
        ans %= mod;
    }

    cout << ans + mp[{0,0}] - 1 << '\n';
    return 0;
}

