#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
const long long mod = 1e9 + 7;
int n;
double a[N], b[N];
map<double, long long> mp1, mp2;
map<double, bool> vis;
long long ans = 1, cnt1, cnt2, cnt;
long long ksm(long long p, long long q) {
  long long ret = 1;
  while (q) {
    if (q & 1) ret = (ret * p) % mod;
    p = (p * p) % mod;
    q = q >> 1;
  }
  return ret;
}
long long f(long long x) { return ksm(2, x) - 1; }
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i] >> b[i];
    if (a[i] == 0 || b[i] == 0) {
      if (a[i] == 0 && b[i] == 0) {
        cnt++;
      } else if (a[i] == 0) {
        cnt1++;
      } else if (b[i] == 0) {
        cnt2++;
      }
      continue;
    }
    mp1[a[i] / b[i]]++;
    mp2[-b[i] / a[i]]++;
  }
  for (int i = 1; i <= n; i++) {
    if (!vis[a[i] / b[i]]) {
      vis[a[i] / b[i]] = 1;
      vis[-b[i] / a[i]] = 1;
      ans = (ans * ((f(max(mp1[a[i] / b[i]], mp2[a[i] / b[i]])) +
                     f(min(mp1[a[i] / b[i]], mp2[a[i] / b[i]])) + 1) %
                    mod)) %
            mod;
    }
  }
  if (cnt) ans++;
  cout << ans - 1;
  return 0;
}
