#include <bits/stdc++.h>
using namespace std;
long long const mod = 1e9 + 7;
long long mpow(long long a, long long b) {
  return b ? mpow(a * a % mod, b / 2) * (b % 2 ? a % mod : 1) % mod : 1;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
int main(void) {
  long long n;
  cin >> n;
  long long c = 0;
  map<pair<long long, long long>, pair<long long, long long> > m;
  for (long long i = 0; i < n; ++i) {
    long long a, b;
    cin >> a >> b;
    if (!a && !b)
      ++c;
    else {
      long long g = gcd(a, b);
      a /= g, b /= g;
      if (a <= 0)
        m[{b, -a}].first++;
      else
        m[{a, b}].second++;
    }
  }
  long long ans = 1;
  for (auto u : m)
    ans =
        (ans * ((mpow(2, u.second.first) + mpow(2, u.second.second) - 1 + mod) %
                mod)) %
        mod;
  ans += c;
  cout << (ans - 1 + mod) % mod;
}
