#include <bits/stdc++.h>
using namespace std;
long long n;
long long a[200005], b[200005];
pair<long long, long long> p[200005];
long long MOD = 1000000007;
long long c[200005];
long long j;
long long k = 1;
long long l;
long long L = 1;
long long ans;
long long gcd(long long x, long long y) {
  if (y == 0) {
    return x;
  }
  return gcd(y, x % y);
}
long long g;
long long mod_pow(long long x, long long n, long long M) {
  if (n == 0) return 1;
  long long res = mod_pow(x * x % M, n / 2, M);
  if (n & 1) res = res * x % M;
  return res;
}
int main(void) {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    g = gcd(a[i], b[i]);
    if (g != 0) {
      a[i] = a[i] / g;
      b[i] = b[i] / g;
    }
    if (b[i] < 0) {
      a[i] = a[i] * (-1);
      b[i] = b[i] * (-1);
    }
    p[i].first = a[i];
    p[i].second = b[i];
  }
  sort(p, p + n);
  for (int i = 0; i < n; i++) {
    if (p[i].first == 0 && p[i].second == 0) {
      ans++;
    } else if (p[i].first > 0) {
      long long X =
          upper_bound(p, p + n, make_pair(p[i].second * (-1), p[i].first)) -
          lower_bound(p, p + n, make_pair(p[i].second * (-1), p[i].first));
      if (X == 0) {
        k = k * 2 % MOD;
      } else {
        if (p[i].first == p[i + 1].first && p[i].second == p[i + 1].second) {
          c[j]++;
        } else {
          c[j]++;
          j++;
          c[j] = X;
          j++;
        }
      }
    } else {
      long long X =
          upper_bound(p, p + n, make_pair(p[i].second, p[i].first * (-1))) -
          lower_bound(p, p + n, make_pair(p[i].second, p[i].first * (-1)));
      if (X == 0) {
        k = k * 2 % MOD;
      }
    }
  }
  for (int i = 0; i < j; i++) {
    l = (l + mod_pow(2, c[i], MOD)) % MOD;
    if (i % 2 == 1) {
      l--;
      if (l < 0) {
        l = l + MOD;
      }
      L = L * l % MOD;
      l = 0;
    }
  }
  ans += L * k % MOD;
  cout << ans - 1 << endl;
}
