#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const long long INF = 1e18;
long long gcd(long long a, long long b) {
  if (a < b) swap(a, b);
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long mod_pow(long long x, long long n) {
  if (n == 0) return 1;
  long long res = mod_pow(x * x % mod, n / 2);
  if (n & 1) res = res * x % mod;
  return res;
}
signed main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  long long n;
  cin >> n;
  map<pair<long long, long long>, long long> mp;
  long long ans = 1;
  for (long long i = 0; i < n; i++) {
    long long a, b;
    cin >> a >> b;
    if (a < 0) {
      a = -a;
      b = -b;
    }
    if (a == 0 && b == 0) continue;
    if (a == 0) b = -1;
    if (b == 0) a = 1;
    long long g = gcd(a, abs(b));
    a /= g;
    b /= g;
    mp[{a, b}]++;
  }
  map<pair<long long, long long>, bool> f;
  for (auto p : mp) {
    if (f[p.first]) continue;
    pair<long long, long long> tmp = {p.first.second, -p.first.first};
    if (tmp.first < 0) {
      tmp.first *= -1;
      tmp.second *= -1;
    }
    long long c1 = p.second;
    long long c2 = mp[tmp];
    ans *= (mod_pow(2, c1) + mod_pow(2, c2) - 1) % mod;
    ans %= mod;
    f[p.first] = true;
    f[tmp] = true;
  }
  ans = (ans - 1 + mod) % mod;
  cout << ans << endl;
}
