#include <bits/stdc++.h>
static const double pi = 3.141592653589793;
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e9 + 7;
const long long mod = 1e9 + 7;
long long N, ans = 1;
long double A[200001], B[200001];
map<long double, long long> mp1;
map<long double, long long> mp2;
long long mod_pow(long long x, long long n) {
  if (n == 0) return 1;
  long long res = mod_pow(x * x % mod, n / 2);
  if (n & 1) res = res * x % mod;
  return res % mod;
}
long long cnt;
int main() {
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(false);
  cin >> N;
  for (long long i = 0; i < N; i++) {
    long double a, b;
    cin >> a >> b;
    A[i] = a;
    B[i] = b;
    if (a == 0 && b == 0)
      cnt++;
    else if (a == 0.0)
      mp1[0.0]++;
    else if (b == 0.0)
      mp2[0.0]++;
    else {
      mp1[a / b]++;
      mp2[b / a]++;
    }
  }
  for (long long i = 0; i < N; i++) {
    long double a, b;
    a = A[i];
    b = B[i];
    if (a == 0.0 || b == 0.0) continue;
    if (mp1[a / b] > 0.0) {
      ans = (ans * ((mod_pow(2, mp1[a / b]) + mod_pow(2, mp2[-a / b])) % mod -
                    1) +
             mod) %
            mod;
      mp1[a / b] = -1;
      mp1[-b / a] = -1;
    }
  }
  ans =
      (ans * ((mod_pow(2, mp1[0.0]) + mod_pow(2, mp2[0.0])) % mod - 1) + mod) %
      mod;
  cout << (ans - 1 + cnt + 10 * mod) % mod << endl;
  return 0;
}
