#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
template <uint_fast64_t m>
int_fast64_t mpow(int_fast64_t x, int_fast64_t n) {
  using i64 = int_fast64_t;
  if (n == 0) return 1;
  if (n % 2)
    return ((x % m) * (mpow<m>(x, n - 1) % m)) % m;
  else {
    i64 half = mpow<m>(x, n / 2) % m;
    return (half * half) % m;
  }
}
int_fast64_t gcd(int_fast64_t a, int_fast64_t b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N;
  cin >> N;
  vector<int> A(N), B(N);
  for (int i = 0; i < N; i++) cin >> A[i] >> B[i];
  map<pii, int> m;
  for (int i = 0; i < N; i++) {
    int g = gcd(A[i], B[i]);
    if (A[i] == 0 && B[i] == 0)
      m[{0, 0}]++;
    else if (B[i] == 0)
      m[{-1, 0}]++;
    else if (A[i] == 0)
      m[{0, 1}]++;
    else {
      int a = A[i] / g;
      int b = B[i] / g;
      if (b < 0) a *= -1, b *= -1;
      m[{a, b}]++;
    }
  }
  map<pii, bool> flag;
  ll ans = 1;
  for (auto it : m) {
    int f = it.first.first;
    int s = it.first.second;
    int a = it.second;
    if (flag[{f, s}]) continue;
    if (f < 0) f *= -1, s *= -1;
    if (flag[{-s, f}]) continue;
    int b = m[{-s, f}];
    ans = (ans *
           ((mpow<1000000007>(2, a) - 1 + mpow<1000000007>(2, b) - 1 + 1) %
                1000000007 +
            1000000007) %
           1000000007) %
          1000000007;
    flag[{f, s}] = true;
    flag[{-s, f}] = true;
  }
  cout << ans - 1 << "\n";
  return 0;
}
