#include <bits/stdc++.h>
static const double pi = 3.141592653589793;
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e9 + 7;
const long long mod = 1e9 + 7;
long long N, ans = 1;
long double A[200001], B[200001];
map<pair<long long, long long>, long long> mp1;
map<pair<long long, long long>, long long> mp2;
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 + mod) % mod;
}
long long gcd(long long x, long long y) {
  if (y > x) swap(x, y);
  while (x % y != 0) {
    long long m = x % y;
    x = y;
    y = m;
  }
  return y;
}
long long cnt;
long long mz, az;
int main() {
  cin.tie(0);
  cout.tie(0);
  ios::sync_with_stdio(false);
  cin >> N;
  for (long long i = 0; i < N; i++) {
    long double a, b;
    cin >> a >> b;
    long long m = gcd(a, b);
    a /= m;
    b /= m;
    A[i] = a;
    B[i] = b;
    if (a == 0 && b == 0)
      cnt++;
    else if (a == 0)
      mz++;
    else if (b == 0)
      az++;
    else {
      mp1[make_pair(a, b)]++;
      mp2[make_pair(b, a)]++;
    }
  }
  for (long long i = 0; i < N; i++) {
    long double a, b;
    a = A[i];
    b = B[i];
    if (a == 0.0 || b == 0.0) continue;
    if (mp1[make_pair(a, b)] > 0) {
      ans =
          (ans * ((mod_pow(2, mp1[make_pair(a, b)] + mp1[make_pair(-a, -b)]) +
                   mod_pow(2, mp2[make_pair(-a, b)] + mp2[make_pair(a, -b)])) %
                      mod -
                  1) +
           mod) %
          mod;
      mp1[make_pair(a, b)] = -1;
      mp1[make_pair(-a, -b)] = -1;
      mp1[make_pair(-b, a)] = -1;
      mp1[make_pair(b, -a)] = -1;
    }
  }
  ans = (ans * ((mod_pow(2, mz) + mod_pow(2, az)) % mod - 1) + mod) % mod;
  cout << (ans - 1 + cnt + 100 * mod) % mod << endl;
  return 0;
}
