#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
using Graph = vector<vector<int>>;
long long gcd(long long a, long long b) {
  a = abs(a);
  b = abs(b);
  if (a == 0 || b == 0) {
    return abs(a + b);
  }
  if (a < b) {
    long long tmp = a;
    a = b;
    b = tmp;
  }
  long long r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
long long RepSq(long long a, long long n, long long mod) {
  if (n == 0) {
    return 1;
  } else if (n % 2 != 0) {
    return (a * RepSq(a, n - 1, mod)) % mod;
  } else {
    long long x = RepSq(a, n / 2, mod);
    return (x * x) % mod;
  }
}
int main() {
  long long n;
  cin >> n;
  long long mod = 1000000007;
  long long a[n], b[n], g[n];
  map<pair<long long, long long>, long long> mp;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    g[i] = gcd(a[i], b[i]);
    a[i] /= g[i];
    b[i] /= g[i];
    if (a[i] < 0 || (a[i] == 0 && b[i] > 0)) {
      a[i] *= -1;
      b[i] *= -1;
    }
    mp[make_pair(a[i], b[i])]++;
  }
  long long ans = 1;
  long long rest = n;
  for (auto p : mp) {
    long long x, y, z, w;
    x = p.first.first;
    y = p.first.second;
    z = p.second;
    if (y < 0) {
      w = mp[make_pair(-y, x)];
      if (w != 0) {
        ans = (ans * (RepSq(2, z, mod) + RepSq(2, w, mod) - 1)) % mod;
      }
      rest = rest - z - w;
    }
  }
  ans = (RepSq(2, rest, mod) * ans) % mod;
  cout << (ans + mod - 1) % mod;
}
