#include <bits/stdc++.h>
using namespace std;
long gcd(long x, long y) { return (x % y == 0 ? y : gcd(y, x % y)); }
long pow(long x) {
  if (x == 0) return 1;
  if (x % 2)
    return pow(x - 1) * 2 % 1000000007;
  else {
    long y = pow(x / 2);
    return y * y % 1000000007;
  }
}
int main() {
  long N;
  cin >> N;
  vector<pair<long, long> > S, T;
  long ans = 0;
  for (long i = 0; i < N; i++) {
    long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      ans++;
      continue;
    }
    if ((a < 0 && b <= 0) || (a >= 0 && b < 0)) {
      a *= -1;
      b *= -1;
    }
    if (a > 0 && b >= 0) {
      if (b == 0)
        S.push_back(pair<long, long>(1, 0));
      else {
        long g = gcd(a, b);
        S.push_back(pair<long, long>(a / g, b / g));
      }
    } else if (a <= 0 && b > 0) {
      if (a == 0)
        T.push_back(pair<long, long>(0, 1));
      else {
        long g = gcd(-a, b);
        T.push_back(pair<long, long>(b / g, -a / g));
      }
    } else
      cout << "error";
  }
  map<pair<long, long>, pair<long, long> > VST;
  for (pair<long, long> s : S) {
    VST[s].first++;
  }
  for (pair<long, long> t : T) {
    VST[t].second++;
  }
  long x = 1;
  for (const auto& [k, v] : VST) {
    x = x * (pow(v.first) + pow(v.second) - 1) % 1000000007;
  }
  assert((ans + x - 1) % 1000000007 > 0);
  cout << (ans + x - 1) % 1000000007;
}
