#include <iostream>
#include <vector>
#include <bitset>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
 
using namespace std;
typedef long long ll;

const ll MOD=1000000007;

int main(){
  int N;
  cin >> N;

  vector<ll> p2(N+1,0);
  p2[0]=1;
  ll cur=1;
  for(int i=1;i<N+1;i++){
    cur*=2; cur%=MOD;
    p2[i]=cur; 
  }

  map<pair<ll,ll>,ll> m;
  for(int i=0;i<N;i++){
    ll a,b; cin >> a >> b;
    ll ta=a,tb=b;
    if(ta==0 && tb==0){
      m[make_pair<ll,ll>(0,0)]++;
      continue;
    }
    if(ta==0){
      m[make_pair<ll,ll>(0,1)]++;
      continue;
    }
    if(tb==0){
      m[make_pair<ll,ll>(1,0)]++;
      continue;
    }
    while(ta!=0){
      tb%=ta; swap(ta,tb);
    }
    a/=tb; b/=tb;
    if(a<0){
      a*=-1; b*=-1;
    }
    //cout << a << b << endl;
    m[make_pair<ll,ll>(a,b)]++;
  }

  ll ans=1;
  for(auto &mi:m){
    if(mi.first.first==0 && mi.first.second==0) continue;
    pair<ll,ll> tmp;
    if(mi.first.second>=0){
      tmp.first=mi.first.second; tmp.second=-mi.first.first;
    }else{
      tmp.first=-mi.first.second; tmp.second=mi.first.first;
    }
    ll ansi=0;
    ansi+=p2[m[tmp]];
    ansi+=p2[mi.second];
    ans*=ansi-1;
    ans%=MOD;
    m[tmp]=0;
    mi.second=0;
  }

  

  cout << (ans-1+p2[m[make_pair<ll,ll>(0,0)]]-1+2*MOD)%MOD << endl;


  return 0;
}
