#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
void normalize(long long& A, long long& B) {
  if (A < 0) {
    A = -A;
    B = -B;
  } else if (A == 0) {
    if (B < 0) {
      B = -B;
    }
  }
}
long long twoPowMod(long long n) {
  if (n == 0) {
    return 1;
  }
  if (n == 1) {
    return 2;
  }
  long long half = twoPowMod(n / 2);
  long long ret = half * half % MOD;
  if (n % 2) {
    ret *= 2;
    ret %= MOD;
  }
  return ret;
}
int main() {
  int N;
  cin >> N;
  vector<long long> A(N);
  vector<long long> B(N);
  map<pair<long long, long long>, long long> cnt;
  for (int i = 0; i < N; ++i) {
    cin >> A[i] >> B[i];
    long long g = gcd(A[i], B[i]);
    A[i] /= g;
    B[i] /= g;
    normalize(A[i], B[i]);
    ++cnt[make_pair(A[i], B[i])];
  }
  auto iter = cnt.begin();
  long long ans = 1;
  while (iter != cnt.end()) {
    long long A = iter->first.first;
    long long B = iter->first.second;
    long long OB = -A;
    long long OA = B;
    normalize(OA, OB);
    long long res = 0;
    res += twoPowMod(cnt[make_pair(A, B)]);
    res += twoPowMod(cnt[make_pair(OA, OB)]);
    --res;
    res %= MOD;
    cnt[make_pair(A, B)] = cnt[make_pair(OA, OB)] = 0;
    ans *= res;
    ans %= MOD;
    ++iter;
  }
  cout << ans - 1 << endl;
  return 0;
}
