#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000000 + 7;
long long gcd(long long a, long long b) {
  if (a % b == 0)
    return (b);
  else
    return (gcd(b, a % b));
}
long long modPow(int n, int num) {
  if (num == 0) return 1;
  long long res = modPow(n, num / 2);
  if (num % 2 == 0)
    res = (res * res) % MOD;
  else
    res = (((res * res) % MOD) * n) % MOD;
  return res;
}
int main() {
  int N;
  cin >> N;
  vector<long long> A(N), B(N);
  for (int i = 0; i < (int)(N); i++) cin >> A[i] >> B[i];
  map<pair<long long, long long>, int> mp;
  int zero = 0;
  int zeroOne = 0;
  int oneZero = 0;
  for (int i = 0; i < (int)(N); i++) {
    if (A[i] == 0 && B[i] == 0)
      ++zero;
    else if (A[i] == 0)
      ++zeroOne;
    else if (B[i] == 0)
      ++oneZero;
    else {
      long long g = gcd(A[i], B[i]);
      if (B[i] > 0)
        ++mp[make_pair(A[i] / g, B[i] / g)];
      else
        ++mp[make_pair(-A[i] / g, -B[i] / g)];
    }
  }
  long long ans = 1;
  int goodCount = N - zero - oneZero - zeroOne;
  for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
    int p1 = itr->second;
    int p2 = mp[make_pair(-itr->first.second, itr->first.first)];
    mp[make_pair(-itr->first.second, itr->first.first)] = 0;
    if (p2 != 0) {
      goodCount -= p1 + p2;
      ans *= (modPow(2, p1) - 1 + modPow(2, p2)) % MOD;
    }
  }
  if (zeroOne * oneZero != 0)
    ans *= (modPow(2, zeroOne) - 1 + modPow(2, oneZero)) % MOD;
  else
    goodCount += zeroOne + oneZero;
  ans *= modPow(2, goodCount);
  ans %= MOD;
  cout << ans - 1 + zero;
}
