#include <bits/stdc++.h>
using namespace std;
const int MAXN = 234567;
const long long MOD = (long long)1e9 + 7;
long long pw2[MAXN];
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  pw2[0] = 1;
  for (int i = 1; i < MAXN; i++) pw2[i] = (pw2[i - 1] * 2) % MOD;
  int N;
  scanf("%d", &N);
  map<pair<long long, long long>, int> mp;
  for (int i = 0; i < N; i++) {
    long long a, b;
    scanf("%lld %lld", &a, &b);
    int coef = 1;
    if (a * b < 0) coef = -1;
    a = abs(a), b = abs(b);
    long long g = gcd(a, b);
    a /= g, b /= g;
    mp[make_pair(coef * a, b)]++;
  }
  long long ans = 1;
  for (auto it = mp.begin(); it != mp.end(); it++) {
    if (it->second == 0) continue;
    long long a = it->first.first, b = it->first.second;
    int coef = -1;
    if (a < 0) {
      coef = 1;
      a *= -1;
    }
    auto rv = make_pair(coef * b, a);
    if (!mp.count(rv)) {
      ans = (ans * pw2[it->second]) % MOD;
      continue;
    }
    long long tmp = (pw2[it->second] + pw2[mp[rv]] - 1) % MOD;
    if (tmp < 0) assert(false);
    ans = (ans * tmp) % MOD;
    if (ans < 0) assert(false);
    mp[rv] = 0;
  }
  printf("%lld\n", (ans - 1 + MOD) % MOD);
  return 0;
}
