#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(long long)(n);i++)
#define all(a) a.begin(), a.end()
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  
  int n;
  cin >> n;
  int zero=0;
  vector<ll>two(200020,1ll);
  rep(i,n+2){
    two[i+1]=two[i]*2;
    two[i]%=MOD;
  }
  map<P,P>mp;
  rep(i,n){
    ll x,y;
    cin >> x >> y;
    if(x==0 && y==0){
      zero++;
      continue;
    }
    ll g=gcd(x,y);
    x/=g;
    y/=g;
    if(y<0){
      x=-x;
      y=-y;
    }
    if(y==0 && x<0){
      x=-x;
      y=-y;
    }
    if(x>0) mp[P(x,y)].first++;
    else mp[P(y,-x)].second++;
  }
  ll ans=1;
  for(auto p:mp){
    ans=ans*(two[p.second.first]+two[p.second.second]-1)%MOD;
  }
  ans+=zero;
  cout << (ans+MOD-1)%MOD << endl;
  
  return 0;     
}
