#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  while (min(a, b) > 0) {
    if (a < b) swap(a, b);
    a %= b;
  }
  return max(a, b);
}
long long dx[] = {0, 1, 0, -1, 1, -1, -1, 1};
long long dy[] = {1, 0, -1, 0, 1, 1, -1, -1};
const long long MOD = 1e9 + 7;
const long long INF = 1e18 + 10;
long long modpow(long long x, long long n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = (res * x) % MOD;
    x = (x * x) % MOD;
    n >>= 1;
  }
  return res;
}
pair<long long, long long> hanten(pair<long long, long long> p) {
  auto q = make_pair(p.second, p.first);
  if (q.first < 0) {
    q.first *= -1;
  } else {
    q.second *= -1;
  }
  return q;
}
signed main() {
  long long n;
  cin >> n;
  map<pair<long long, long long>, long long> v;
  long long cnt0 = 0;
  for (long long i = 0; i < (n); i++) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      auto p = make_pair(0, 0);
      v[p]++;
      cnt0++;
    } else if (a == 0) {
      auto p = make_pair(0, 1);
      v[p]++;
    } else if (b == 0) {
      auto p = make_pair(1, 0);
      v[p]++;
    } else {
      long long k = gcd(abs(a), abs(b));
      a /= k;
      b /= k;
      if (a < 0) {
        a *= -1;
        b *= -1;
      }
      auto p = make_pair(a, b);
      v[p]++;
    }
  }
  long long ans = 1;
  for (auto mp : v) {
    auto p = mp.first;
    if (p.first == 0 && p.second == 0)
      continue;
    else {
      auto q = hanten(p);
      ans *= modpow(2, v[p]) + modpow(2, v[q]) - 1;
      ans %= MOD;
      v[p] = 0;
      v[q] = 0;
    }
  }
  ans += cnt0;
  ans--;
  cout << ans << endl;
  return 0;
}
