#include <bits/stdc++.h>
using namespace std;
const long long N = 200005;
long long power(long long a, long long b, long long p) {
  if (a == 0) return 0;
  long long res = 1;
  a %= p;
  while (b > 0) {
    if (b & 1) res = (res * a) % p;
    b >>= 1;
    a = (a * a) % p;
  }
  return res;
}
int32_t main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout.precision(std::numeric_limits<double>::max_digits10);
  ;
  long long n, ans = 1, g = 0;
  cin >> n;
  long double INF = 2000000000000000000;
  map<long double, long long> mp;
  while (n--) {
    long double a, b, z;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      g = 1;
      continue;
    }
    if (a == 0)
      z = INF;
    else if (b == 0)
      z = (1.0 / INF) * -1;
    else
      z = a / b;
    mp[z]++;
  }
  for (auto it = mp.begin(); it != mp.end(); it++) {
    long double x = (*it).first;
    if (mp.find(-1.0 / x) != mp.end()) {
      ans *= (power(2, mp[x], 1000000007) + power(2, mp[-1.0 / x], 1000000007) -
              1);
      mp.erase(-1.0 / x);
    } else {
      ans *= power(2, mp[x], 1000000007);
    }
    ans %= 1000000007;
  }
  ans = (ans + 1000000007 - 1 + g) % 1000000007;
  cout << ans;
}
