#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
const long long mod = 1e9 + 7;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  long long n;
  cin >> n;
  vector<long long> p(200001);
  long long v = 1;
  for (long long i = 0; i < (200001); i++) {
    p[i] = v;
    v *= 2;
    v %= mod;
  }
  map<pair<long long, long long>, long long> m;
  map<pair<long long, long long>, bool> s;
  for (long long i = 0; i < (n); i++) {
    long long p, q;
    cin >> p >> q;
    if (p == 0 && q == 0) {
      m[make_pair(0, 0)]++;
      continue;
    }
    if (p == 0 && q != 0) {
      m[make_pair(0, 1)]++;
      continue;
    }
    if (p != 0 && q == 0) {
      m[make_pair(1, 0)]++;
      continue;
    }
    long long r = gcd(p, q);
    p /= r;
    q /= r;
    m[make_pair(p, q)]++;
  }
  long long ans = 1;
  for (auto x : m) {
    if (x.first.first == 0 && x.first.second == 0) {
      continue;
    }
    if (s.count(make_pair(x.first.first, x.first.second))) {
      continue;
    }
    long long sum1 = 0;
    if (m.count(make_pair(-x.first.second, x.first.first))) {
      sum1 += m[make_pair(-x.first.second, x.first.first)];
      s[make_pair(-x.first.second, x.first.first)] = true;
    }
    if (m.count(make_pair(x.first.second, -x.first.first))) {
      sum1 += m[make_pair(x.first.second, -x.first.first)];
      s[make_pair(x.first.second, -x.first.first)] = true;
    }
    long long sum2 = 0;
    if (m.count(make_pair(x.first.first, x.first.second))) {
      sum2 += m[make_pair(x.first.first, x.first.second)];
      s[make_pair(x.first.first, x.first.second)] = true;
    }
    if (m.count(make_pair(-x.first.first, -x.first.second))) {
      sum2 += m[make_pair(-x.first.first, -x.first.second)];
      s[make_pair(-x.first.first, -x.first.second)] = true;
    }
    ans *= (p[sum1] + p[sum2] - 1) % mod;
  }
  ans += m[make_pair(0, 0)];
  cout << (ans + mod - 1) % mod << endl;
  return 0;
}
