#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 200005;
const long long MOD = 1e9 + 7;
long long A[MAX_N], B[MAX_N];
map<pair<long long, long long>, pair<long long, long long> > ab;
long long mygcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return mygcd(b, a % b);
}
long long pow2(long long n) {
  if (n == 0) return long long(1);
  if (n == 1) return long long(2);
  if (n % 2 == 0) {
    long long p = pow2(n / 2);
    return p * p % MOD;
  } else {
    return 2 * pow2(n - 1) % MOD;
  }
}
int main() {
  long long N;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> A[i] >> B[i];
    long long g = mygcd(abs(A[i]), abs(B[i]));
    if (g != 0) {
      A[i] /= g;
      B[i] /= g;
    }
  }
  long long ans = 1;
  long long cnt0 = 0;
  for (int i = 0; i < N; i++) {
    if (A[i] == 0 && B[i] == 0) {
      cnt0++;
      continue;
    }
    if (A[i] < 0) {
      A[i] *= -1;
      B[i] *= -1;
    }
    if (B[i] > 0)
      ab[pair<long long, long long>(A[i], B[i])].first++;
    else
      ab[pair<long long, long long>(long long(-1) * B[i], A[i])].second++;
  }
  for (auto i : ab) {
    ans = ans * (pow2(i.second.first) + pow2(i.second.second) + MOD - 1) % MOD;
  }
  ans = (ans + cnt0 + MOD - 1) % MOD;
  cout << ans << endl;
  return 0;
}
