#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <bits/stdc++.h>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
using Real = mp::number<mp::cpp_dec_float<1024>>;
#define lli long long int
#define uli unsigned long long int
#define INF 9999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(25) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define MAX 10000000
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
lli repow(lli n,lli k,lli m){
  if(k==0)return 1;
  else if(k%2==1)return repow(n,k-1,m)*n%m;
  else{
    lli temp=repow(n,k/2,m);
    return temp*temp%m;
  }
}
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli A,B,C,D,E,F,N,M,K,L,X,Y,Z,H,W,sum=0,num=0,flag=0;string S,T;
  cin >> N;
  map<Real,int>mp1;
  map<Real,int>mp2;
  rep(i,0,N){
    cin >> A >> B;
    if(A==B&&A==0)flag++;
    else if(B==0)mp1[INF]++;
    else if(A==0)mp2[INF]++;
    else if((long double)A/B>=0)mp1[(Real)A/B]++;
    else mp2[-(Real)B/A]++;
  }
  num=1;
  set<Real>st;
  for(auto v:mp1)st.insert(v.first);
  for(auto v:mp2)st.insert(v.first);
  for(auto v:st){
    if(mp1.find(v)!=mp1.end()&&mp2.find(v)!=mp2.end()){
      num*=(repow(2,mp1[v],mod)+repow(2,mp2[v],mod)-1)%mod;
    }
    else if(mp1.find(v)!=mp1.end()){
      num*=repow(2,mp1[v],mod);
    }
    else{
      num*=repow(2,mp2[v],mod);
    }
    num%=mod;
  }
  Out((num+mod+flag-1)%mod);
}
