#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const int INF = 2e9;
;
long long gcd(long long a, long long b) {
  if (a < b) swap(a, b);
  while (b > 0) {
    long long tmp = b;
    b = a % b;
    a = tmp;
  }
  return a;
}
long long binary_power(long long a, long long n) {
  if (n == 0) return 1;
  long long k = binary_power(a, n / 2);
  if (n % 2 == 0)
    return (k * k) % MOD;
  else
    return (((k * k) % MOD) * a) % MOD;
}
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  map<pair<long long, long long>, long long> mp;
  for (long long i = 0; i < n; i++) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 & b == 0) continue;
    long long c = gcd(abs(a), abs(b));
    if (a < 0) {
      a = -a;
      b = -b;
    }
    ++mp[make_pair(a / c, b / c)];
  }
  long long ans = 1;
  for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
    if (itr->second == 0) continue;
    long long a = itr->first.first, b = itr->first.second;
    long long c = b, d = -a;
    if (c < 0) {
      c = -c;
      d = -d;
    }
    pair<long long, long long> p = make_pair(c, d);
    long long ii = binary_power(2, itr->second);
    if (mp.find(p) != mp.end()) {
      long long jj = binary_power(2, mp[p]);
      ans = (ans * ((ii + jj - 1) % MOD)) % MOD;
      mp[p] = 0;
    } else {
      ans = (ans * ii) % MOD;
    }
  }
  cout << (ans + MOD - 1) % MOD << endl;
  return 0;
}
