#include <bits/stdc++.h>
using namespace std;
using P = pair<long long, long long>;
static const long long MOD = 1000000007;
static const long long LINF = (long long)(1e18 + 99);
static const int INF = 1e9 + 99;
long long mod_pow(long long x, long long n) {
  if (n == 0) return 1;
  long long res = mod_pow(x * x % MOD, n / 2);
  if (n & 1) res = res * x % MOD;
  return res;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long ans = 1, n, a[200005], b[200005];
int main(void) {
  cin >> n;
  long long zero = 0;
  for (int i = (0); i < (n); i++) cin >> a[i] >> b[i];
  for (int i = (0); i < (n); i++) {
    long long x = a[i], y = b[i];
    if (x == 0 && y == 0) continue;
    long long g = gcd(x, y);
    x /= g, y /= g;
    if ((x > 0 && y < 0) || (x < 0 && y < 0)) x *= -1, y *= -1;
    a[i] = x, b[i] = y;
  }
  map<P, P> m;
  for (int i = (0); i < (n); i++) {
    long long x = a[i], y = b[i];
    if (x == 0 && y == 0) {
      zero++;
      continue;
    }
    bool f = false;
    if (x <= 0) {
      long long tmp = x;
      x = y;
      y = -tmp;
      f = true;
    }
    auto t = make_pair(x, y);
    f ? m[t].second++ : m[t].first++;
  }
  for (auto p : m) {
    long long s = p.second.first, t = p.second.second;
    long long x = mod_pow(2, s) - 1;
    x += mod_pow(2, t) - 1;
    x += 1;
    x %= MOD;
    ans *= x;
    ans %= MOD;
  }
  ans += zero;
  ans--;
  ans %= MOD;
  cout << ans << endl;
  return 0;
}
