#include <bits/stdc++.h>
using namespace std;
const int MAX = 510000;
const int MOD = 1000000007;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  long long N;
  cin >> N;
  vector<pair<long long, long long> > a(N);
  for (long long i = 0; i < N; i++) cin >> a[i].first >> a[i].second;
  sort(a.begin(), a.end());
  for (long long i = 0; i < N; i++) {
    if (a[i].first == 0 and a[i].second == 0) continue;
    long long tmp = gcd(abs(a[i].first), abs(a[i].second));
    a[i].first /= tmp;
    a[i].second /= tmp;
  }
  bool zero = false;
  long long leftzero = 0, rightzero = 0;
  map<pair<long long, long long>, long long> map;
  for (long long i = 0; i < N; i++) {
    if (a[i].first == 0 and a[i].second == 0) {
      zero = true;
      continue;
    } else if (a[i].first == 0 and a[i].second != 0) {
      leftzero++;
      continue;
    } else if (a[i].first != 0 and a[i].second == 0) {
      rightzero++;
      continue;
    }
    map[make_pair(a[i].first, a[i].second)]++;
  }
  long long ans = 1;
  ans *= (leftzero + 1) * (rightzero + 1);
  for (auto p : map) {
    long long a = -p.first.second;
    long long b = p.first.first;
    long long c = p.first.second;
    long long d = -p.first.first;
    if (map[make_pair(a, b)] > 0 or map[make_pair(c, d)] > 0) {
      long long cnt = (map[p.first] + 1) *
                          (map[make_pair(a, b)] + map[make_pair(c, d)] + 1) -
                      1;
      map[make_pair(a, b)] = 0;
      map[make_pair(c, d)] = 0;
      ans *= cnt;
      ans %= MOD;
    } else {
      ans *= map[p.first] + 1;
      ans %= MOD;
    }
  }
  ans = ans + MOD - 1;
  ans %= MOD;
  if (zero) ans++;
  cout << ans << endl;
}
