#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long rep_pow(int n, int p) {
  if (p == 0) {
    return 1;
  }
  if (p % 2 == 0) {
    long long t = rep_pow(n, p / 2);
    return t * t % MOD;
  } else {
    return n * rep_pow(n, p - 1) % MOD;
  }
}
int main() {
  int n;
  cin >> n;
  map<pair<long long, long long>, long long> mp;
  for (int i = 0; i < n; ++i) {
    long long a, b;
    cin >> a >> b;
    long long g = gcd(abs(a), abs(b));
    pair<long long, long long> key = {a / g, b / g};
    if (mp.count(key)) {
      ++mp[key];
    } else {
      mp[key] = 1;
    }
  }
  long long ans = 1;
  map<pair<long long, long long>, long long> watched;
  for (const auto &kv : mp) {
    auto key = kv.first;
    auto val = kv.second;
    if (watched.count(key)) {
      continue;
    }
    watched[key] = 1;
    watched[{-key.first, -key.second}] = 1;
    watched[{key.second, -key.first}] = 1;
    watched[{-key.second, key.first}] = 1;
    long long c1 = val + mp[{-key.first, -key.second}];
    long long c2 = mp[{key.second, -key.first}] + mp[{-key.second, key.first}];
    long long mul = rep_pow(2, c1) + rep_pow(2, c2);
    ans *= (mul - 1);
    ans %= MOD;
  }
  cout << ans - 1;
  return 0;
}
