#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1000000007;
long long int gcd(long long int a, long long int b) {
  while (b > 0) {
    long long int rem = a % b;
    a = b;
    b = rem;
  }
  return a;
}
pair<long long int, long long int> reducedFraction(long long int dividend,
                                                   long long int divisor) {
  if (dividend == 0) {
    if (divisor == 0)
      return pair<int, int>(0, 0);
    else
      return pair<int, int>(0, 1);
  } else if (divisor == 0) {
    return pair<int, int>(1, 0);
  }
  if (dividend < 0) {
    dividend = -dividend;
    divisor = -divisor;
  }
  int g = gcd(abs(dividend), abs(divisor));
  return pair<int, int>(dividend / g, divisor / g);
}
long long int modpow(long long int a, long long int b, long long int m = mod) {
  long long int r = 1;
  while (b > 0) {
    if (b & 1) r = (r * a) % m;
    a = (a * a) % m;
    b >>= 1;
  }
  return r;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<pair<long long int, long long int> > ab(n);
  for (auto &x : ab) cin >> x.first >> x.second;
  for (int i = 0; i < n; i++)
    ab[i] = reducedFraction(ab[i].first, ab[i].second);
  map<pair<long long int, long long int>, pair<long long int, long long int> >
      ratioCount;
  for (int i = 0; i < n; i++) {
    pair<long long int, long long int> complement =
        pair<long long int, long long int>(ab[i].second, -ab[i].first);
    if (complement.first < 0)
      complement = pair<long long int, long long int>(-complement.first,
                                                      -complement.second);
    auto it = ratioCount.find(complement);
    if (it != ratioCount.end())
      ratioCount[complement].second++;
    else
      ratioCount[ab[i]].first++;
  }
  long long int zerozeroCount = 0;
  long long int ans = 1;
  for (auto &x : ratioCount) {
    if (x.first == pair<long long int, long long int>(0LL, 0LL)) {
      zerozeroCount = x.second.first + x.second.second;
      continue;
    }
    long long int c1 = 0;
    long long int c2 = 0;
    if (x.second.first > 0) c1 = modpow(2, x.second.first) - 1;
    if (x.second.second > 0) c2 = modpow(2, x.second.second) - 1;
    ans = (ans * (1LL + c1 + c2)) % mod;
  }
  ans = (ans + zerozeroCount - 1) % mod;
  if (ans < 0) ans += mod;
  cout << ans << endl;
  return 0;
}
