#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a == 0 && b == 0) return 1;
  if (a == 0) return b;
  if (b == 0) return a;
  if (a % b == 0) return b;
  return gcd(b, a % b);
}
void set_two_pow(vector<long long> &v, long long n) {
  v[0] = 1;
  for (long long i = 1; i < n + 1; i++) {
    v[i] = v[i - 1] * 2;
    v[i] %= 1000000007;
  }
}
signed main() {
  long long N;
  cin >> N;
  vector<long long> two_pow(N + 1, 0);
  set_two_pow(two_pow, N);
  map<pair<long long, long long>, pair<long long, long long>> m;
  long long nO = 0;
  for (long long i = 0; i < N; i++) {
    long long a, b;
    cin >> a >> b;
    long long d = gcd(abs(a), abs(b));
    a /= d;
    b /= d;
    if (a == 0 && b == 0) {
      nO++;
    } else if (a * b >= 0) {
      pair<long long, long long> p;
      p.first = a;
      p.second = b;
      if (m.find(p) == m.end()) {
        m[p] = pair<long long, long long>(1, 0);
      } else {
        m[p].first++;
      }
    } else {
      pair<long long, long long> p;
      p.first = abs(b);
      p.second = abs(a);
      if (m.find(p) == m.end()) {
        m[p] = pair<long long, long long>(0, 1);
      } else {
        m[p].second++;
      }
    }
  }
  long long ans = 1;
  for (const auto &[key, value] : m) {
    long long tmp = two_pow[value.first] + two_pow[value.second] - 1;
    tmp %= 1000000007;
    ans *= tmp;
    ans %= 1000000007;
  }
  ans--;
  ans += two_pow[nO] - 1;
  cout << ans % 1000000007 << endl;
}
