#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
double pi = 3.1415926535;
long long power(long long x, long long n) {
  if (n == 0) return 1;
  long long res = power(x * x % mod, n / 2);
  if (n & 1) res = res * x % mod;
  return res;
}
int main() {
  int n;
  cin >> n;
  long long a[n];
  long long b[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }
  map<double, int> c, d;
  for (int i = 0; i < n; i++) {
    if (a[i] != 0 || b[i] != 0) {
      c[(a[i] + 0.0) / b[i]]++;
      d[(b[i] + 0.0) / a[i]]++;
    }
  }
  long long ans = 1;
  for (auto p : c) {
    if (d.count(-p.first)) {
      if (p.first < 0) {
        long long cur = power(2, p.second) + power(2, d[-p.first]) - 1;
        if (cur < 0) cur += mod;
        cur %= mod;
        ans *= cur;
        ans %= mod;
      }
    } else {
      ans *= power(2, p.second);
      ans %= mod;
    }
  }
  ans--;
  if (ans < 0) ans += mod;
  cout << ans << endl;
}
