#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> llP;

ll mod(ll a, ll b){
  ll ret=a%b;
  if(ret<0) ret+=b;
  return ret;
}

ll modpow(ll a,ll b,ll c){
  ll res=1;
  while(b>0){
    if(b&1) res=mod(res*a,c);
    a=mod(a*a,c);
    b>>=1;
  }
  return res;
}

int main() {
  ll MOD=1000000007;
  int n;
  cin>>n;
  ll a[n],b[n];
  map<llP,int> memo;
  map<llP,int> memo2;
  for(int i=0;i<n;i++){
    cin>>a[i]>>b[i];
    ll c=abs(a[i]),d=abs(b[i]);
    if(c==0 and d==0) memo[make_pair(0,0)]++;
    else if(c==0) memo[make_pair(0,-1)]++;
    else if(d==0) memo[make_pair(1,0)]++;
    else{
      while(c%d!=0){
        ll temp=d;
        d=c%d;
        c=temp;
      }
      a[i]/=d;b[i]/=d;
      if(a[i]<0) {
        a[i]=-a[i];
        b[i]=-b[i];
      }
      memo[make_pair(a[i],b[i])]++;
    }
  }
  if(n==2 and a[0]*a[1]+b[0]*b[1]==0){
    cout<<0<<endl;
    return 0;
  }
  ll ans=0;
  vector<ll> anss;
  for(auto itr=memo.begin();itr!=memo.end();itr++){
    if(itr->first==make_pair(0,0)) continue;
    ll f=itr->first.first,s=itr->first.second;
    if(s<0){
      if(memo2[make_pair(f,s)]>0)continue;
      if(memo.count(make_pair(-s,f))){
        anss.push_back(memo[make_pair(f,s)]);
        anss.push_back(memo[make_pair(-s,f)]);
        memo2[make_pair(f,s)]++;memo2[make_pair(-s,f)]++;
      }
      else ans+=itr->second;
    }
    else{
      if(memo2[make_pair(f,s)]>0)continue;
      if(memo.count(make_pair(s,-f))){
        anss.push_back(memo[make_pair(f,s)]);
        anss.push_back(memo[make_pair(s,-f)]);
        memo2[make_pair(f,s)]++;memo2[make_pair(s,-f)]++;
      }
      else ans+=itr->second;
    }
  }
  ll sum=1;
  if(ans!=0) sum=mod(modpow(2,ans,MOD),MOD);
  for(int i=0;i<anss.size()-1;i+=2){
    sum=mod(sum*mod(((modpow(2,anss[i],MOD))+modpow(2,anss[i+1],MOD)-1),MOD),MOD);
  }
  cout<<mod(sum-1,MOD)<<endl;
  return 0;
}