#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;
  int cnt = 0, z0 = 0, z1 = 0, z2 = 0;
  using P = pair<long long, long long>;
  map<P, int> mp;
  for (int i = 0; i < N; ++i) {
    long long a, b;
    cin >> a >> b;
    long long g = gcd(a, b);
    if (a == 0 && b == 0) {
      ++z0;
      ++cnt;
      continue;
    }
    if (a / g < 0) {
      a *= -1;
      b *= -1;
    }
    if (a / g == 0) {
      ++z1;
      ++cnt;
    } else if (b / g == 0) {
      ++z2;
      ++cnt;
    } else
      ++mp[P(a / g, b / g)];
  }
  long long ans = 1;
  for (auto e : mp) {
    long long a = e.first.first, b = e.first.second;
    if (b < 0)
      continue;
    else if (mp[P(a, b)] != 0 && mp[P(b, -a)] != 0) {
      ans = ans *
            (((pow_mod(2, mp[P(a, b)]) - 1) % MOD +
              (pow_mod(2, mp[P(b, -a)]) - 1) % MOD + 1) %
             MOD) %
            MOD;
      cnt += mp[P(a, b)] + mp[P(b, -a)];
    }
  }
  ans = ans * (((pow_mod(2, z1) - 1) + (pow_mod(2, z2) - 1) + 1) % MOD) % MOD;
  ans = ans * pow_mod(2, N - cnt) % MOD;
  ans -= 1;
  while (ans < 0) ans += MOD;
  cout << ans % MOD << endl;
}
