#include <bits/stdc++.h>
using namespace std;
long long gcd(long long x, long long y) { return y ? gcd(y, x % y) : x; }
long long lcm(long long x, long long y) { return x / gcd(x, y) * y; }
long long jou(long long N, long long P) {
  if (P == 0) return 1;
  if (P % 2 == 0) {
    long long t = jou(N, P / 2);
    return t * t % 1000000007;
  }
  return (N * jou(N, P - 1)) % 1000000007;
}
int main() {
  int n;
  cin >> n;
  int az = 0;
  int bz = 0;
  int abz = 0;
  vector<long long> a(n);
  vector<long long> b(n);
  map<pair<long long, long long>, int> p;
  for (int i = 0; i < (int)(n); i++) {
    cin >> a[i] >> b[i];
    if (a[i] == 0 && b[i] != 0) az++;
    if (b[i] == 0 && a[i] != 0) bz++;
    if (a[i] == 0 && b[i] == 0) abz++;
    if (a[i] != 0 && b[i] != 0) {
      long long c = gcd(abs(a[i]), abs(b[i]));
      if (a[i] < 0) c = -c;
      auto x = make_pair(a[i] / c, b[i] / c);
      if (p.count(x))
        p.at(x)++;
      else
        p[x] = 1;
    }
  }
  long long ans = 1;
  for (auto x : p) {
    auto y = make_pair(x.first.second, -x.first.first);
    if (x.first.second < 0) {
      y.first *= -1;
      y.second *= -1;
    }
    if (p.count(y)) {
      long long memo = jou(2, x.second) + jou(2, p.at(y)) - 1;
      memo %= 1000000007;
      ans *= memo;
      ans %= 1000000007;
      p.erase(y);
    } else {
      ans *= jou(2, x.second);
      ans % 1000000007;
    }
  }
  ans *= jou(2, az) + jou(2, bz) - 1;
  ans %= 1000000007;
  ans += abz;
  ;
  cout << (ans - 1) % 1000000007 << endl;
}
