#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long pow_mod(long long x, long long n) {
  long long res = 1;
  while (n) {
    if (n & 1) res = res * x % MOD;
    x = x * x % MOD;
    n >>= 1;
  }
  return res;
}
int main() {
  int N;
  cin >> N;
  using P = pair<long long, long long>;
  map<P, long long> mp;
  vector<long long> a(N), b(N);
  bool exist_zero = false;
  for (int i = 0; i < N; ++i) {
    cin >> a[i] >> b[i];
    long long g = gcd(a[i], b[i]);
    if (a[i] == 0 && b[i] == 0) {
      exist_zero = true;
      continue;
    }
    a[i] /= g;
    b[i] /= g;
    ++mp[P(a[i], b[i])];
  }
  long long ans = 1;
  for (auto e : mp) {
    if (mp[P(e.first.first, e.first.second)] == 0) continue;
    if (mp[P(-e.first.second, e.first.first)] != 0) {
      ans = ans *
            ((pow_mod(2, mp[P(e.first.first, e.first.second)]) +
              pow_mod(2, mp[P(-e.first.second, e.first.first)]) - 1) %
             MOD) %
            MOD;
      mp[P(-e.first.second, e.first.first)] = 0;
    } else if (mp[P(e.first.second, -e.first.first)] != 0) {
      ans = ans *
            ((pow_mod(2, mp[P(e.first.first, e.first.second)]) +
              pow_mod(2, mp[P(e.first.second, -e.first.first)]) - 1) %
             MOD) %
            MOD;
      mp[P(e.first.second, -e.first.first)] = 0;
    } else {
      ans = ans * pow_mod(2, mp[P(e.first.first, e.first.second)]) % MOD;
    }
  }
  ans -= 1;
  if (exist_zero) ans += 1;
  while (ans < 0) ans += MOD;
  cout << ans << endl;
}
