#include <bits/stdc++.h>
using namespace std;
constexpr int64_t mod = 1000000007;
int64_t gcd(int64_t a, int64_t b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int64_t power(int64_t n, int64_t k) {
  if (k == 0) return 1;
  int64_t ans = power(n * n % mod, k / 2);
  if (k % 2) {
    ans = ans * n % mod;
  }
  return ans;
}
int main() {
  int n;
  cin >> n;
  map<pair<int64_t, int64_t>, int64_t> count;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      count[make_pair(0, 0)]++;
      continue;
    }
    int64_t e = gcd(abs(a), abs(b));
    a /= e;
    b /= e;
    if (a < 0 || (a == 0 && b < 0)) {
      a = -a;
      b = -b;
    }
    count[make_pair(a, b)]++;
    if (b < 0 || (b == 0 && a > 0)) {
      b = -b;
      a = -a;
    }
    auto f = make_pair(b, -a);
    count[f] += 0;
  }
  int64_t ans = 1;
  for (auto e : count) {
    auto p = make_pair(e.first.second, -e.first.first);
    if (p.first < 0 || (p.first == 0 && p.second < 0)) {
      p.first = -p.first;
      p.second = -p.second;
    }
    if (e.first >= p) continue;
    ans *= (power(2, e.second) + power(2, count[p]) + mod - 1) % mod;
    ans %= mod;
  }
  cout << (ans + mod - 1 + count[make_pair(0, 0)]) % mod << endl;
  return 0;
}
