#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1}, dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int upint(const void *a, const void *b) {
  return *(int *)a < *(int *)b ? -1 : *(int *)a > *(int *)b ? 1 : 0;
}
int downint(const void *a, const void *b) {
  return *(int *)a < *(int *)b ? 1 : *(int *)a > *(int *)b ? -1 : 0;
}
int upchar(const void *left, const void *right) {
  return strcmp((char *)left, (char *)right);
}
int downchar(const void *left, const void *right) {
  return strcmp((char *)right, (char *)left);
}
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) {
      res *= a;
      if (mod >= 1) res %= mod;
    }
    a *= a;
    if (mod >= 1) a %= mod;
    n >>= 1;
  }
  return res;
}
void initialize() {}
int main(void) {
  initialize();
  long long n, m, i, j, k, result = 0, zero = 0;
  int a[500002] = {0}, b[200002] = {0};
  string s;
  map<pair<long long, long long>, long long> dp;
  map<pair<long long, long long>, bool> ok;
  long long az = 0, bz = 0;
  cin >> n;
  for ((i) = 0; (i) < (n); (i)++) {
    cin >> a[i] >> b[i];
    if (a[i] == 0 && b[i] == 0) {
      zero++;
    } else if (a[i] == 0) {
      dp[{0, 1}]++;
    } else if (b[i] == 0) {
      dp[{-1, 0}]++;
    } else {
      long long tmp = gcd(a[i], b[i]);
      a[i] /= tmp;
      b[i] /= tmp;
      if (b[i] > 0) {
        dp[{a[i], b[i]}]++;
      } else {
        dp[{-a[i], -b[i]}]++;
      }
    }
  }
  result = 1;
  for (const auto &[key, value] : dp) {
    long long tmp = 1;
    if (ok.count(key)) continue;
    pair<long long, long long> key2 =
        pair<long long, long long>(-key.second, key.first);
    if (key2.second < 0) {
      key2.first *= -1;
      key2.second *= -1;
    }
    long long value2 = (dp.count(key2) ? dp[key2] : 0);
    tmp += modpow(2, value, 1000000007) - 1;
    tmp += modpow(2, value2, 1000000007) - 1;
    tmp %= 1000000007;
    result *= tmp;
    result %= 1000000007;
    ok[key] = true;
    ok[key2] = true;
  }
  result += (zero - 1 + 1000000007) % 1000000007;
  result %= 1000000007;
  cout << result << endl;
  return 0;
}
