#include <bits/stdc++.h>
using namespace std;
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
long long dep(long long a, long long b) {
  if (b == 0) {
    return a;
  }
  return dep(b, a % b);
}
int main() {
  long long n;
  cin >> n;
  long long a[200010], b[200010];
  for (long long i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    if (b[i] < 0) {
      b[i] = abs(b[i]);
      a[i] = -1 * a[i];
    }
  }
  map<pair<long long, long long>, long long> q;
  long long cnt00 = 0;
  for (long long i = 0; i < n; i++) {
    if (a[i] == 0 && b[i] == 0) {
      cnt00++;
      cnt00 %= 1000000007;
      continue;
    }
    if (a[i] == 0) {
      q[make_pair(0, 1)]++;
      continue;
    }
    if (b[i] == 0) {
      q[make_pair(1, 0)]++;
      continue;
    }
    bool mi = false;
    if (a[i] < 0) {
      mi = true;
      a[i] = -1 * a[i];
    }
    long long gcd = dep(max(a[i], b[i]), min(a[i], b[i]));
    if (mi) {
      a[i] = -1 * a[i];
    }
    q[make_pair(a[i] / gcd, b[i] / gcd)]++;
  }
  long long ans = 1;
  for (auto itr = q.begin(); itr != q.end(); itr++) {
    pair<long long, long long> num = itr->first;
    long long A = num.second;
    long long B = num.first;
    B = -1 * B;
    long long val = itr->second;
    auto itr2 = q.find(make_pair(A, B));
    if (itr2 == q.end() || q[make_pair(A, B)] == 0) {
      long long A1 = modpow(2, val, 1000000007);
      ans *= A1;
      ans %= 1000000007;
    } else {
      long long A1 = modpow(2, val, 1000000007);
      long long B1 = modpow(2, q[make_pair(A, B)], 1000000007);
      q[make_pair(A, B)] = 0;
      ans *= (A1 + B1 - 1);
      ans %= 1000000007;
    }
  }
  cout << (ans - 1 + cnt00) % 1000000007;
  return 0;
}
