#include<bits/stdc++.h>
#define ll long long
using namespace std;

//ll mod=1000000007;
ll a,b,k,sol,a2,b2;
int n,m1,m2,n2;
double d;
set<double> S;
map<double,int> M;
ll arr[200005];

ll gcd(ll x, ll y) {
    if (x%y==0) {return y;}
    else {gcd(y,x%y);}
}

int main() {
    cin >> n;
    for (int i=0;i<n;i++) {
        cin >> a >> b;
        a2=abs(a);
        b2=abs(b);
        k=gcd(max(a2,b2),min(a2,b2));
        a/=k;
        b/=k;
        d=(double)a/double(b);
        S.insert(d);
        M[d]++;
    }

    arr[0]=1;
    for (int i=1;i<=n;i++) {
        arr[i]=((arr[i-1]*2)%1000000007);
    }

//    sort(V.begin(),V.end());
    sol=1;
    for (auto e : S) {
        if (e<0 && M[-1/e]>0) {
            m1=M[e];
            m2=M[-1/e];
            sol*=(arr[m1]+arr[m2]-1);
        }
        else if (M[-1/e]==0) {
            sol*=2;
        }
        sol%=mod;
    }
    cout << sol -1;

}
