#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
#define int long long
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}


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

    int N;
    cin>>N;

    int A[N],B[N];
    int ans=0;
    int c0=0;
    map<pair<int,int>,int> m;
    COMinit();
    rep(i,N) {
        cin>>A[i]>>B[i];
        if(B[i]<0){
            A[i]*=-1;
            B[i]*=-1;
        }

        if(A[i]==0&&B[i]==0) c0++;
        else if(B[i]==0) m[make_pair(1,0)]++;
        else if(A[i]==0) m[make_pair(0,1)]++;
        else m[make_pair(A[i]/__gcd(A[i],B[i]),B[i]/__gcd(A[i],B[i]))]++;
    }
    N-=c0;
    
    int sum=1;
    for(auto p:m){
        int de=0;
        int d=0;
        int na=p.first.first;
        int nb=p.first.second;
        int nx=p.second;
        if(nx==0) continue;
        if(na<0 && m[make_pair(nb,-na)]>0)continue;
        if(na==0&&m[make_pair(1,0)]>0) continue;
        
        
        int x=m[make_pair(-nb,na)];
        rep(i,nx){
            d+=COM(nx,i);
        }
        rep(i,x){
            de+=COM(x,i);
        }
        sum=(sum*((d+de+1)%MOD))%MOD;

    }
    ans=(sum+c0)%MOD;
    while(ans<0) ans+=MOD;
    cout << ans << endl;
    







}
