#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001
#define mod 1000000007
#define mod2 998244353
#define pi 3.141592653589793
#define all(v) v.begin(),v.end()


ll gcd(ll a,ll b){
    if(b>a) swap(a,b);
    if(b==0) return a;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll g=gcd(a,b);
    return a/g*b;
}
ll rep_jijo(ll n,ll x){
    if(x==0) return 1;
    if(x%2==0){
        ll t=rep_jijo(n,x/2);
        return t*t%mod;
    }
    return n*rep_jijo(n,x-1)%mod;
}

int main(){
    int n;
    cin >> n;
    int tmp=n;
    vector<double>a(n);
    vector<double>b(n);
    vector<ll>ng;
    map<double,int>mp;
    rep(i,n) cin >> a[i] >> b[i];
    int cnt_a=0;
    int cnt_b=0;
    rep(i,n){
        if(a[i]==0&&b[i]==0)tmp--;
        else if(a[i]==0) {
            cnt_a++;
            tmp--;
        }
        else if(b[i]==0) {
            cnt_b++;
            tmp--;
        }
        else{
            mp[a[i]/b[i]]++;
            mp[-1*(b[i]/a[i])]++;
        }
    }
    int len=0;
    for(auto p:mp){
        if(p.second>1) {
            ng.emplace_back(p.second);
        }
    }
    ll ans=1;
    rep(i,nd.size()){
        tmp-=ng[i];
        ans*=ng[i];
        ans%=mod;
    }
    ans*=cnt_a;
    ans%=mod;
    ans*=cnt_b;
    ans%=mod;
    ans=ans*rep_jijo(2,tmp);
    ans%=mod;
    cout << ans << endl;
    return 0;
}

