#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
const int mod = 1000000007;
long long GCD(long long p, long long q) { return (p == 0) ? q : GCD(q % p, p); }
long long a[maxn], b[maxn];
int id[maxn];
bool cmp(int p, int q) {
  return (b[p] == b[q]) ? (a[p] < a[q]) : (b[p] < b[q]);
}
int main() {
  int n;
  long long x, y, gcd;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> x >> y;
    if (x == 0 || y == 0) {
      a[i] = x;
      b[i] = y;
      continue;
    }
    gcd = GCD(x, y);
    if (x > 0 && y > 0) {
      a[i] = x / gcd;
      b[i] = y / gcd;
      continue;
    }
    if (x < 0 && y < 0) {
      a[i] = -x / gcd;
      b[i] = -y / gcd;
      continue;
    }
    if (x > 0 && y < 0) {
      a[i] = -y / gcd;
      b[i] = x / gcd;
      continue;
    }
    if (x < 0 && y > 0) {
      a[i] = y / gcd;
      b[i] = -x / gcd;
      continue;
    }
    id[i] = i;
  }
  sort(id + 1, id + 1 + n, cmp);
  int zero = 0, now = 0;
  long long ans = 1;
  for (int i = 1; i <= n; i++) {
    if (a[i] == 0 && b[i] == 0) {
      zero++;
      continue;
    }
    if (a[i] == a[i - 1] && b[i] == b[i - 1])
      now++;
    else {
      ans = (ans * (now + 1)) % mod;
      now = 1;
    }
  }
  ans = (ans * (now + 1)) % mod;
  ans += zero;
  ans += mod - 1;
  ans %= mod;
  cout << ans << endl;
  return 0;
}
