#include <bits/stdc++.h>
using namespace std;
long long dx8[8] = {-1, 0, 1, 1, 1, 0, -1, -1};
long long dy8[8] = {1, 1, 1, 0, -1, -1, -1, 0};
long long dx4[4] = {-1, 0, 1, 0};
long long dy4[4] = {0, -1, 0, 1};
template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
pair<long long, long long> solve(pair<long long, long long> p) {
  long long a = p.first, b = p.second;
  if (b > 0) {
    return make_pair(b, -a);
  }
  return make_pair(-b, a);
}
long long mod_pow(long long x, long long n, long long mm) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * x % mm;
    x = x * x % mm;
    n >>= 1;
  }
  return res;
}
signed main() {
  long long N;
  cin >> N;
  map<pair<long long, long long>, long long> M;
  for (long long i = 0; i < N; i++) {
    long long a, b;
    cin >> a >> b;
    long long g = abs(gcd(a, b));
    a /= g;
    b /= g;
    if (a == 0) b = abs(b);
    if (a < 0) {
      a = -a;
      b = -b;
    }
    M[make_pair(a, b)]++;
  }
  long long ans = 1;
  for (auto x : M) {
    pair<long long, long long> p = x.first;
    long long n = x.second;
    if (n == 0) continue;
    long long m = M[solve(p)];
    long long s = mod_pow(2, n, 1000000007);
    if (m > 0) {
      s += mod_pow(2, m, 1000000007);
      s -= 1;
    }
    ans = (ans * s) % 1000000007;
    M[p] = 0;
    M[solve(p)] = 0;
  }
  cout << (ans + 1000000007 - 1) % 1000000007 << endl;
}
