#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e9 + 7;
const long long mod = 1e9 + 7;
const double PI = M_PI;
long long gcd(long long a, long long b) {
  if (min(a, b) == 0) return max(a, b);
  if (max(a, b) % min(a, b) == 0) return min(a, b);
  return gcd(min(a, b), max(a, b) % min(a, b));
}
long long rui(long long a, long long b) {
  long long res = 1, x = a;
  while (b) {
    if (b & 1) res = res * x % inf;
    x = x * x % inf;
    b /= 2;
  }
  return res;
}
signed main() {
  long long n;
  cin >> n;
  map<pair<long long, long long>, long long> ma;
  long long cnt = 0;
  for (long long i = (0); i < (n); i++) {
    long long a, b;
    cin >> a >> b;
    if (a < 0) {
      a = -a;
      b = -b;
    }
    if (a == 0) {
      if (b != 0) b = 1;
    } else {
      if (b != 0) {
        long long c = gcd(a, abs(b));
        a /= c;
        b /= c;
      } else {
        a = 1;
      }
    }
    if (a == b && a == 0) {
      cnt++;
      continue;
    }
    ma[make_pair(a, b)]++;
  }
  for (auto e : ma) {
    long long x = e.second;
    long long a = e.first.first;
    long long b = e.first.second;
  }
  long long ans = 1;
  for (auto e : ma) {
    long long x = e.second;
    long long a = e.first.first;
    long long b = e.first.second;
    long long c, d;
    if (b < 0) {
      c = -b;
      d = a;
    } else {
      c = b;
      d = -a;
    }
    long long y = ma[make_pair(c, d)];
    cout << a << ' ' << b << ' ' << c << ' ' << d << ' ' << x << ' ' << y
         << '\n';
    ans = ans * (rui(2, y) + rui(2, x) - 1) % inf;
    ma[make_pair(a, b)] = 0;
    ma[make_pair(c, d)] = 0;
  }
  ans += cnt - 1;
  ans %= inf;
  if (ans < 0) ans += inf;
  cout << ans << '\n';
}
