#include <bits/stdc++.h>
#include <cmath>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverse(A.begin(),A.end());
typedef long long ll;

ll mod = (ll)pow(10,9)+7;

ll mpow2(ll a){
  if(a == 0) return 1;
  return (2*mpow2(a-1))%mod;
}

int main(){
  int n;
  cin >> n;
  int zero = 0;
  map<pair<ll,ll>,pair<int,int>> mp;
  rep(i,n){
    ll a,b;
    cin >> a >> b;
    if(a==0 && b==0){
      zero ++;
      continue;
    }
    ll g = gcd(a,b);
    a /= g;
    b /= g;
    bool rev = 0;
    if(b < 0){
      a = -a;
      b = -b;
    }
    if(a <= 0){
      ll tmp = a;
      a = b;
      b = -tmp;
      rev = 1;
    }
    if(rev == 0) mp[{a,b}].first++;
    if(rev == 1) mp[{a,b}].second++;
  }
  ll ans = 1;
  for(auto p : mp){
    ll s = p.second.first;
    ll t = p.second.second;
    ll tmp = mpow2(s)+mpow2(t)-1;
    tmp %= mod;
    ans *= tmp;
    ans %= mod;
  }
  cout << (ans+zero-1)%mod << endl;
}