#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -f;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
template <typename T>
inline void Max(T &a, T &b) {
  if (a < b) a = b;
}
template <typename T>
inline void Min(T &a, T &b) {
  if (a > b) a = b;
}
const double pi = (double)acos(-1.0);
const double eps = (double)1e-8;
const int INF = (int)0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const int MAXN = (int)2e5 + 10;
const int MAXM = (int)3e6 + 10;
map<double, int> mp;
long long ans;
set<double> st;
long long power(long long x, long long y) {
  long long ret = 1;
  for (; y; y >>= 1, x = x * x % MOD)
    if (y & 1) {
      ret = ret * x % MOD;
    }
  return ret;
}
void work() {
  int N;
  scanf("%d", &N);
  ans = 1;
  int A0 = 0, B0 = 0, C = 0;
  for (int i = 1; i <= N; i++) {
    long long A, B;
    scanf("%lld%lld", &A, &B);
    if (A == 0 && B == 0) {
      C++;
    } else if (A == 0)
      A0++;
    else if (B == 0)
      B0++;
    else {
      mp[A * 1.0 / B]++;
    }
  }
  map<double, int>::iterator it = mp.begin();
  while (it != mp.end()) {
    double a = it->first;
    int cnt = it->second;
    it++;
    if (st.count(a)) {
      continue;
    }
    if (cnt == 0) continue;
    double aa = -1.0 / a;
    if (st.count(aa)) {
      continue;
    }
    if (!mp.count(aa)) {
      ans = ans * power(2, cnt) % MOD;
    } else {
      int cnt2 = mp[aa];
      ans = ans * ((power(2, cnt) + power(2, cnt2) - 1) % MOD) % MOD;
      st.insert(a);
      st.insert(aa);
    }
  }
  ans = ans * ((power(2, A0) + power(2, B0) - 1) % MOD) % MOD;
  printf("%lld\n", (ans + C - 1) % MOD);
}
int main() {
  work();
  return 0;
}
