#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int MOD = 1000000007;
const int MAX_N = 2e5;
map<long double, 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 ret = 1;
  while (n) {
    if (n & 1) ret = a * ret % MOD;
    a = a * a % MOD;
    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;
      long double k = long double(B[i]) / long double(A[i]);
      cnt[k] = cnt[k] + 1;
    }
  }
  for (map<long double, int>::iterator itr = cnt.begin(); itr != cnt.end();
       ++itr) {
    long double k = itr->first;
    int num = itr->second;
    ret = ret * ((power(2, num) + power(2, cnt[-1 / k]) - 1) % MOD) % MOD;
    cnt[k] = cnt[-1 / k] = 0;
  }
  ret = ret * (power(2, X) + power(2, Y) - 1) % MOD;
  ret = ret + power(2, zero) - 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);
}
