#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
map<pair<long long, long long>, int> ma;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long qpow(int a, int b) {
  long long res = 1;
  while (b) {
    if (b & 1) {
      res *= (a * 1LL);
      res %= mod;
    }
    a *= 1LL;
    a *= a;
    a %= mod;
    b /= 2;
  }
  return res;
}
int main() {
  int n, s = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    long long a, b;
    cin >> a >> b;
    long long g = gcd(a, b);
    if (g == 0) {
      s++;
      continue;
    }
    a /= g, b /= g;
    if (a < 0) a = -a, b = -b;
    ma[{a, b}]++;
  }
  long long ans = 1;
  for (auto it : ma) {
    if (it.second == 0) continue;
    long long a = it.first.first;
    long long b = it.first.second;
    long long d = qpow(2, ma[{a, b}]);
    b = -b;
    if (b < 0) a = -a, b = -b;
    if (ma.count({b, a})) {
      d += (qpow(2, ma[{b, a}]) - 1);
      d %= mod;
      ma[{b, a}] = 0;
    }
    ans *= d;
    ans %= mod;
  }
  ans = (ans - 1 + s + mod) % mod;
  cout << ans << endl;
  return 0;
}
