#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define MOD 998244353
#define INF 1145141919810893364
//#define INF 810114514
#define PI 3.141592653589
typedef long long ll;
typedef pair<ll,ll> PP;
#define int ll
#define setdouble setprecision
#define REP(i,n) for(int i=0;i<(n);++i)
#define OREP(i,n) for(int i=1;i<=(n);++i)
#define RREP(i,n) for(int i=(n)-1;i>=0;--i)
#define GOODBYE do { cout << "0" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl
#define debug false
#define debug2 false

int N;
vector<int> fact;
vector<int> factIE;
int I2;

long long power(long long b,long long e){
  long long r=1;
  while(e){
      if(e&1){
          r=(r*b)%MOD;
      }
      b=(b*b)%MOD;
      e >>=1;
  }
  return r;
}

long long inverse(long long b){
  long long r=1,e=MOD-2;
  while(e){
      if(e&1){
          r=(r*b)%MOD;
      }
      b=(b*b)%MOD;
      e >>=1;
  }
  return r;
}


int comb(int n,int r){
    int R = fact[n];
    R = (R*factIE[r])%MOD;
    R = (R*factIE[n-r])%MOD;
    return R;
}

int calc(int a,int b){
    int A=0,B=0;
    int k = I2;
    OREP(i,a){
        int c = comb(a,i);
        int d = (c*k)%MOD;
        if(i%2==1){d = (MOD-d)%MOD;}
        A = (A+d)%MOD;
        k = (k*I2)%MOD;
    }
    k = I2;
    OREP(i,b){
        int c = comb(b,i);
        int d = (c*k)%MOD;
        if(i%2==1){d = (MOD-d)%MOD;}
        B = (B+d)%MOD;
        k = (k*I2)%MOD;
    }
    int R = (A*B)%MOD;
    return R;
    
}


signed main(void){
    int N,a,b;
    vector<pair<int,int>> AB;
    map<pair<int,int>,int> M;
    
    cin >> N;
    int ng = 0;
    REP(i,N){
        cin >> a >> b;
        if(a==0 && b==0){
            ng++;
            continue;
        }
        int sign=1;
        if(a<0){a*=-1;sign*=-1;}
        if(b<0){b*=-1;sign*=-1;}
        int g = std::gcd(a,b);
        a/=g;b/=g;
        a*=sign;
        AB.push_back({a,b});
        M[{a,b}]++;
    }
    N-=ng;
    
    
    fact.push_back(1);
    REP(i,N){
        int r = fact[i];
        r = (r*(i+1))%MOD;
        fact.push_back(r);
    }
    
    REP(i,N+1){
        int r = fact[i];
        factIE.push_back(inverse(r));
    }
    
    I2 = inverse(2);
    
    
    int P = power(2,N);
    int Ans = P;
    
    map<pair<int,int>,int> visited;
    
    REP(i,N){
        int A = AB[i].first;
        int B = AB[i].second;
        if(A<0)continue;
        if(visited[AB[i]]!=0)continue;
        visited[AB[i]]=1;
        
        int p = M[{A,B}];
        int q = M[{-B,A}];
        int r = calc(p,q);
        //cout << p MM q MM r << endl;
        //r = (r)%MOD;
        r = (1LL+MOD-r)%MOD;
        
        Ans = (Ans*r)%MOD;
    }
    Ans = (Ans+MOD-1) %MOD;
    cout << Ans << endl;
    
    
    return 0;
}


