#include <bits/stdc++.h>
using namespace std;
const int MN = 2e5 + 5;
const int mod = 1e9 + 7;
int n, Ans, cnt0, cnt1;
map<double, int> mp, vis;
inline long long qpow(long long a, long long b) {
  register long long res = 1;
  while (b) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return res;
}
int main() {
  scanf("%d", &n);
  for (register int i = 1; i <= n; i++) {
    static long long x, y;
    scanf("%lld%lld", &x, &y);
    if (!x && !y)
      Ans++;
    else if (!x)
      cnt0++;
    else if (!y)
      cnt1++;
    else
      mp[((double)x) / y]++;
  }
  register int Res = (qpow(2, cnt0) + qpow(2, cnt1) - 1) % mod;
  for (auto x : mp) {
    if (!x.second) continue;
    if (vis[x.first]) continue;
    Res =
        1ll * Res * (qpow(2, x.second) + qpow(2, mp[-1.0 / x.first]) - 1) % mod;
    vis[-1.0 / x.first] = 1;
  }
  printf("%d\n", (Res + Ans - 1) % mod);
  return 0;
}
