#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const ll MOD = 1000000007;
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long pow(long long a, long long b) {
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % MOD;
    a = a * a % MOD;
    b >>= 1;
  }
  return res;
}
int main() {
  int n;
  cin >> n;
  map<pair<ll, ll>, int> mp;
  int zero_num;
  for (int i = 0; i < (n); ++i) {
    ll a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      zero_num++;
    } else if (a == 0) {
      mp[make_pair(0ll, 1ll)]++;
    } else if (b == 0) {
      mp[make_pair(1ll, 0ll)]++;
    } else {
      ll g = gcd(a, b);
      a /= g;
      b /= g;
      if (a < 0) {
        a = -a;
        b = -b;
      }
      mp[make_pair(a, b)]++;
    }
  }
  ll ans = 1;
  for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
    pair<ll, ll> p = itr->first;
    if (p.second < 0)
      p = make_pair(-p.second, p.first);
    else
      p = make_pair(p.second, -p.first);
    ll tmp = pow(2ll, itr->second) + pow(2ll, mp[p]) - 1;
    ans *= tmp;
    ans %= MOD;
    itr->second = 0;
    mp[p] = 0;
  }
  ans--;
  ans += zero_num;
  ans %= MOD;
  cout << ans << endl;
  return 0;
}
