#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
map<pair<long long, long long>, int> m;
long long p2[202020];
long long GCD(int a, int b) {
  if (a % b == 0) return b;
  return GCD(b, a % b);
}
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
int main() {
  p2[0] = 1;
  for (int i = 0; i < (202020); ++i) p2[i + 1] = (p2[i] * 2) % MOD;
  int N;
  cin >> N;
  long long ans = 1;
  int z = 0;
  for (int i = 0; i < (N); ++i) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      z++;
    } else if (a == 0) {
      m[{0, -1}]++;
    } else if (b == 0) {
      a = 1;
      m[{1, 0}]++;
    } else {
      long long gcd = GCD(a, b);
      a /= gcd;
      b /= gcd;
      if (a < 0) {
        a = -a;
        b = -b;
      }
      m[{a, b}]++;
    }
  }
  for (auto m0 : m) {
    long long a0 = m0.first.first;
    long long b0 = m0.first.second;
    long long a1, b1, t = 1;
    if (m[{a0, b0}] != 0) {
      if (b0 < 0) {
        a1 = -b0;
        b1 = a0;
      } else {
        a1 = b0;
        b1 = -a0;
      }
      t = (p2[m[{a0, b0}]] + p2[m[{a1, b1}]] - 1) % MOD;
      m[{a1, b1}] = 0;
    }
    m[{a0, b0}] = 0;
    ans = (ans * t) % MOD;
  }
  cout << ((ans + z - 1) % MOD) << endl;
}
