#include <bits/stdc++.h>
using namespace std;
int n, a[200010], b[200010], Count_a, Count_b, f[200010];
map<double, int> Rep, Sgn;
set<double> S;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &a[i], &b[i]);
    if ((a[i] == 0) && (b[i] == 0)) continue;
    if (a[i] == 0) {
      Count_a++;
      continue;
    }
    if (b[i] == 0) {
      Count_b++;
      continue;
    }
    Rep[1.0 * a[i] / b[i]]++;
    S.insert(1.0 * a[i] / b[i]);
  }
  f[0] = 1ll;
  for (int i = 1; i <= n; i++) f[i] = (f[i - 1] * 2ll) % 1000000007;
  long long Res = 1ll;
  for (auto p : S)
    if (!Sgn[p]) {
      Sgn[p] = 1;
      if (Rep[-1 / p] != 0) Sgn[-1 / p] = 1;
      Res = (Res * (f[Rep[p]] + f[Rep[-1 / p]] - 1) % 1000000007) % 1000000007;
    }
  Res =
      ((Res * (f[Count_a] + f[Count_b] - 1) % 1000000007) % 1000000007 - 1ll) %
      1000000007;
  if (Res < 0) Res += 1000000007;
  printf("%lld\n", Res);
}
