#include <bits/stdc++.h>
#define REP(i, n) for(long long i=0; i<n; i++)
#define REPR(i, n) for(long long i=n-1; i>=0; i--)
#define FOR(i, m, n) for(long long i=m; i<=n; i++)
#define FORR(i, m, n) for(long long i=m; i>=n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
#define FIN ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;
const ll mod = 1e9+7;
const ll inf = 1e15;

ll power(ll a,ll b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}

int main(){FIN

    ll n;cin>>n;
    map<double,ll> c, d;
    vector<double> a(n), b(n);
    vector<P> pairs;
    ll allzero = 0;
    REP(i,n) {
        cin>>a[i]>>b[i];
        if(a[i]==0 && b[i]!=0) c[0.0]++; 
        else if (b[i]==0 && a[i]!=0) d[0.0]++; //別扱い
        else if (a[i]==0 && b[i]==0) allzero++;

        else{
            c[b[i]/a[i]]++;
            d[a[i]/b[i] * (-1)]++;
        }
    }
    n -= allzero;
    ll sum = 1;
    for(auto p :c){
        if(d[p.first]){
            
            ll x = p.second;
            ll y = d[p.first];
            d[p.first]=0;
            if(p.first != 0) d[-1/p.first] = 0;
            else d[0.0] = 0;

            n -= x; n-= y;
            sum *= (x+1) * (y+1) -1;
            sum %= mod;
        } 

    ll ans = (sum * power(2,n) -1)%mod;
    if (allzero) ans+=allzero;
    cout<<ans%mod<<endl;
    return 0;
}