#include <bits/stdc++.h>
using namespace std;
long long mod(long long a, long long b) {
  long long ret = a % b;
  if (ret < 0) ret += b;
  return ret;
}
long long modpow(long long a, long long b, long long c) {
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = mod(res * a, c);
    a = mod(a * a, c);
    b >>= 1;
  }
  return res;
}
int main() {
  long long MOD = 1000000007;
  int n;
  cin >> n;
  long long a[n], b[n];
  map<pair<long long, long long>, int> memo;
  map<pair<long long, long long>, int> memo2;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    long long c = abs(a[i]), d = abs(b[i]);
    if (c == 0 and d == 0)
      memo[make_pair((long long)0, (long long)0)]++;
    else if (c == 0)
      memo[make_pair((long long)0, (long long)-1)]++;
    else if (d == 0)
      memo[make_pair((long long)1, (long long)0)]++;
    else {
      while (c % d != 0) {
        long long temp = d;
        d = c % d;
        c = temp;
      }
      a[i] /= d;
      b[i] /= d;
      if (a[i] < 0) {
        a[i] = -a[i];
        b[i] = -b[i];
      }
      memo[make_pair(a[i], b[i])]++;
    }
  }
  if (n == 2 and a[0] * a[1] + b[0] * b[1] == 0) {
    cout << 0 << endl;
    return 0;
  }
  long long ans = 0;
  vector<long long> anss;
  for (auto itr = memo.begin(); itr != memo.end(); itr++) {
    if (itr->first == make_pair((long long)0, (long long)0)) continue;
    long long f = itr->first.first, s = itr->first.second;
    if (s < 0) {
      if (memo2[make_pair(f, s)] > 0) continue;
      if (memo.count(make_pair(-s, f))) {
        anss.push_back(memo[make_pair(f, s)]);
        anss.push_back(memo[make_pair(-s, f)]);
        memo2[make_pair(f, s)]++;
        memo2[make_pair(-s, f)]++;
      } else
        ans += itr->second;
    } else {
      if (memo2[make_pair(f, s)] > 0) continue;
      if (memo.count(make_pair(s, -f))) {
        anss.push_back(memo[make_pair(f, s)]);
        anss.push_back(memo[make_pair(s, -f)]);
        memo2[make_pair(f, s)]++;
        memo2[make_pair(s, -f)]++;
      } else
        ans += itr->second;
    }
  }
  long long sum = 1;
  if (ans != 0) sum = mod(modpow(2, ans, MOD), MOD);
  for (int i = 0; i < anss.size() - 1; i += 2) {
    sum = mod(
        sum * mod(((modpow(2, anss[i], MOD)) + modpow(2, anss[i + 1], MOD) - 1),
                  MOD),
        MOD);
  }
  cout << mod(sum - 1, MOD) << endl;
  return 0;
}
