#include <bits/stdc++.h>
using namespace std;
 
#define int long long
const int MOD = 1e9 + 7;
using ll = long long;
using ld = long double;
using intpair = pair<int, int>;
//struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;
inline int mod (ll a, int m = MOD) { return (a % m + m) % m; }
 
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) ((ll)((a) + (b) - 1)/(ll)(b))

class rational {
public:
    int r, d;
    rational(int R, int D){
        if(R==0 && D==0){
            r = d = 0;
            return;
        }
        int g = gcd(abs(R),abs(D));
        if(D < 0) g = -g;
        r = R / g; d = D / g;
    }
    
    bool operator <(const rational other) const {
        return this->r * other.d < this->d * other.r;
    }
    
    bool operator >(const rational other) const {
        return this->r * other.d > this->d * other.r;
    }
    
    bool operator ==(const rational other) const {
        return this->r == other.r && this->d == other.d;
    }
};

int modpow(int a, int n){
    int ret = 1;
    while(n>0){
        if(n&1) ret = (ret*a) % MOD;
        a = (a*a) % MOD;
        n >>= 1;
    }
    return ret;
}

signed main() {
    int n; cin >> n;
    int zero_iwashi = 0;
    vector<intpair> iwashi;
    rep(i,n){
        int A, B;
        cin >> A >> B;
        if(A==0 && B==0){
            zero_iwashi++;
            continue;
        }
        iwashi.push_back({A,B});
    }
    
    map<rational,int> adb, bda;
    
    for(auto [A,B] : iwashi){
        adb[rational(A,B)]++;
    }
    
    ll ans = 1;
    for(auto [p,cnt] : adb){
        ll tmp = 1;
        auto [A,B] = p;
        int dnt = adb[rational(-B,A)];
        adb.erase(rational(-B,A));
        tmp += modpow(2, cnt)-1;
        tmp += modpow(2, dnt)-1;
        ans = mod(ans * tmp);
    }
    ans = mod(ans -1 + zero_iwashi);
    
    cout << ans << endl;
}