#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int MOD = 1000000007;
const int SIZE = 100003;
const int MAX_N = 2e5;
map<pair<long long, long long>, pair<int, int> > cnt;
long long A[MAX_N], B[MAX_N];
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int power(long long a, long long n, long long M) {
  a %= M;
  long long ret = 1;
  while (n) {
    if (n & 1) ret = a * ret % M;
    a = a * a % M;
    n >>= 1;
  }
  return ret;
}
int solve(int N) {
  int zero = 0, X = 0, Y = 0;
  long long ret = 1;
  for (int i = 0; i < N; ++i) {
    if (A[i] == 0 && B[i] == 0)
      ++zero;
    else if (A[i] == 0)
      ++X;
    else if (B[i] == 0)
      ++Y;
    else {
      long long d = gcd(abs(A[i]), abs(B[i]));
      A[i] /= d, B[i] /= d;
      if (A[i] < 0) A[i] = -A[i], B[i] = -B[i];
      if (B[i] > 0)
        cnt[pair<long long, long long>(A[i], B[i])].first += 1;
      else
        cnt[pair<long long, long long>(-B[i], A[i])].second += 1;
    }
  }
  for (map<pair<long long, long long>, pair<int, int> >::iterator itr =
           cnt.begin();
       itr != cnt.end(); ++itr) {
    pair<int, int> num = itr->second;
    ret = ret *
          ((power(2, num.first, MOD) + power(2, num.second, MOD) - 1) % MOD) %
          MOD;
  }
  ret = ret * (power(2, X, MOD) + power(2, Y, MOD) - 1) % MOD;
  ret = (ret + power(2, zero, MOD) - 1) % MOD;
  ret = (ret - 1 + MOD) % MOD;
  assert(ret > 0);
  return ret;
}
int main() {
  int N;
  scanf("%d", &N);
  for (int i = 0; i < N; ++i) scanf("%lld%lld", A + i, B + i);
  int ans = solve(N);
  printf("%d\n", ans);
}
