#include <bits/stdc++.h>
using namespace std;
constexpr auto MOD = 1000000007LL;
inline long long modpow(long long a, long long n) {
  long long ret = 1;
  for (long long i = 0; i < n; i++) {
    ret *= a;
    ret %= MOD;
  }
  return ret;
}
inline long long gcd(long long a, long long b) {
  if (a < b) swap(a, b);
  if (a % b == 0)
    return b;
  else
    return gcd(b, a % b);
}
int main() {
  int n;
  cin >> n;
  long long zero = 0;
  map<pair<long long, long long>, vector<int>> bad;
  while (n--) {
    long long x, y;
    cin >> x >> y;
    if (x == 0 && y == 0) {
      zero++;
      continue;
    }
    long long g = gcd(x, y);
    x /= g;
    y /= g;
    if (y < 0) x = -x, y = -y;
    if (y == 0 && x < 0) x = -x, y = -y;
    int rotate90 = (x <= 0);
    if (rotate90) {
      swap(x, y);
      y = -y;
    }
    if (bad.count({x, y}) == 0) bad[{x, y}] = {0, 0};
    bad[{x, y}][rotate90]++;
  }
  long long ans = 1;
  for (auto x : bad) {
    vector<int> c = x.second;
    ans *= (modpow(2, c[0]) - 1) + (modpow(2, c[1]) - 1) + 1;
    ans %= MOD;
  }
  ans += zero - 1;
  ans = (ans + MOD) % MOD;
  cout << ans << endl;
}
