// Sky's the limit :)
#include <bits/stdc++.h>
using namespace std;
#define int long long

const int mod = 1e9 + 7;

int power(int x, int y) {
    int res = 1;
    while(y) {
        if(y & 1) 
            res = res * x % mod;
        x = x * x % mod;
        y >>= 1;
    }
    return res;
}

signed main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    int T = 1; 
    // cin >> T; 
    while (T--) {
        int n;
        cin >> n;
        int a[n], b[n];
        int zero = 0, za = 0, zb = 0;
        map<pair<int, int>, int> mp[2][2];
        vector<pair<int, int> > v;
        for(int i = 0; i < n; i++) {
            cin >> a[i] >> b[i];
            
            if(a[i] == 0 && b[i] == 0)
                zero++;
            else if(a[i] == 0)
                za++;
            else if(b[i] == 0)
                zb++;
            else {
                bool f = a[i] > 0;
                bool s = b[i] > 0;
                a[i] = abs(a[i]);
                b[i] = abs(b[i]);
                int g = __gcd(a[i], b[i]);
                a[i] /= g;
                b[i] /= g;
                mp[f][s][{a[i], b[i]}]++;
                v.push_back({a[i], b[i]});
                v.push_back({b[i], a[i]});
            }
        }

        sort(v.begin(), v.end());
        auto it = unique(v.begin(), v.end());
        v.resize(distance(v.begin(), it));

        int ans = 1;
        for(auto p : v) {
            int c00 = mp[0][0][{p.first, p.second}];
            int c01 = mp[0][1][{p.second, p.first}];
            int c10 = mp[1][0][{p.second, p.first}];
            int c11 = mp[1][1][{p.first, p.second}];

            int cnt = power(2, c00 + c11) + power(2, c01 + c10) - 1;
            ans = ans * cnt % mod;
        }

        int cnt = power(2, za) + power(2, zb) - 1;
        ans = ans * cnt % mod;
        ans += zero;
        
        cout << ans - 1<< '\n';
    }
    
    return 0;
}

