#include <bits/stdc++.h>
long long GCD(long long x, long long y) {
  long long max = std::max(x, y);
  long long min = std::min(x, y);
  if (min == 0) {
    return x;
  } else {
    return GCD(min, max % min);
  }
}
int main() {
  int N;
  scanf("%d", &N);
  std::vector<long long> A(N), B(N);
  std::map<std::pair<long long, long long>, std::pair<int, int> > mp;
  int zero = 0;
  for (int i = 0; i < N; i++) {
    scanf("%lld", &A[i]);
    scanf("%lld", &B[i]);
    if (A[i] == 0 && B[i] == 0) {
      zero++;
    } else {
      long long gcd = GCD(abs(A[i]), abs(B[i]));
      if (A[i] < 0) {
        A[i] *= -1;
        B[i] *= -1;
      }
      if (B[i] == 0) {
        mp[std::make_pair(1, 0)].second++;
      } else if (A[i] == 0) {
        mp[std::make_pair(1, 0)].first++;
      } else if (B[i] < 0) {
        mp[std::make_pair(-B[i] / gcd, A[i] / gcd)].second++;
      } else {
        mp[std::make_pair(A[i] / gcd, B[i] / gcd)].first++;
      }
    }
  }
  long long ans = 1;
  std::vector<long long> power2(N + 4);
  power2[0] = 1;
  long long mod = 1e9 + 7;
  for (int i = 1; i < N + 4; i++) {
    power2[i] = power2[i - 1] * 2;
    power2[i] %= mod;
  }
  for (auto &entry : mp) {
    int num1 = entry.second.first;
    int num2 = entry.second.second;
    ans *= power2[num1] + power2[num2] - 1;
    if (ans >= mod)
      ans %= mod;
    else if (ans < 0)
      ans += mod;
  }
  ans += std::min(1, zero);
  ans--;
  if (ans >= mod)
    ans %= mod;
  else if (ans < 0)
    ans += mod;
  std::cout << ans << std::endl;
  return 0;
}
