#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  return a % b == 0 ? b : gcd(b, a % b);
}
long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; }
const int mod = 1000000007;
long long power(long long x, long long p) {
  long long a = 1;
  while (p > 0) {
    if (p % 2 == 0) {
      x *= x;
      p /= 2;
    } else {
      a *= x;
      p--;
    }
  }
  return a;
}
long long mpower(long long x, long long p) {
  long long a = 1;
  while (p > 0) {
    if (p % 2 == 0) {
      x = x * x % mod;
      p /= 2;
    } else {
      a = a * x % mod;
      p--;
    }
  }
  return a;
}
long long c(long long n, long long k) {
  long long a = 1;
  for (auto i = 1; i < k; i++) {
    a *= n - i + 1;
    a /= i;
  }
  return a;
}
long long mc(long long n, long long m) {
  long long k = 1, l = 1;
  for (auto i = n - m + 1; i < n + 1; i++) k = k * i % mod;
  for (auto i = 1; i < m + 1; i++) l = l * i % mod;
  l = mpower(l, mod - 2);
  return k * l % mod;
}
int main(void) {
  int n;
  cin >> n;
  long long c = 0, ans = 1;
  vector<int> a(n), b(n);
  long long b0 = 0, a0 = 0, r0 = 0;
  map<pair<long long, long long>, pair<long long, long long>> mp;
  for (auto i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    if (b[i] == 0 && a[i] == 0) {
      r0++;
    } else if (b[i] == 0) {
      b0++;
    } else if (a[i] == 0) {
      a0++;
    } else if ((a[i] > 0) ^ (b[i] > 0))
      mp[make_pair(abs(a[i] / gcd(a[i], b[i])), abs(b[i] / gcd(a[i], b[i])))]
          .first++;
    else
      mp[make_pair(abs(b[i] / gcd(a[i], b[i])), abs(a[i] / gcd(a[i], b[i])))]
          .second++;
  }
  for (auto m : mp) {
    ans *= (mpower(2, m.second.second) + mpower(2, m.second.first) - 1) % mod;
    ans %= mod;
  }
  ans *= (mpower(2, a0) + mpower(2, b0) - 1) % mod;
  ans %= mod;
  ans += r0 % mod + mod - 1;
  ans %= mod;
  printf("%lld\n", ans);
  return 0;
}
