#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];


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;
    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]))]++;
    }
    
    int sum=1;
    for(auto p:m){
        int de=1;
        int d=1;
        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)];
        //if(nb==0) x=m[make_pair(0,1)];
        rep(i,nx){
            d*=2;
            d%=MOD;
        }
        if(x!=0){
            rep(i,x){
                de*=2;
                de%=MOD;
            }
        }
        cout << d << de << endl;
        sum=(sum*((d+de-1)%MOD))%MOD;

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







}
