#include <bits/stdc++.h>
using namespace std;
int N;
long long A[200000], B[200000];
map<pair<long long, long long>, long long> pos, neg, Map;
long long zero;
long long modpow(long long a, long long n, long long mod) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
int main() {
  cin >> N;
  for (long long i = 0; i < (long long)(N); i++) {
    cin >> A[i] >> B[i];
    if (A[i] == 0 && B[i] == 0)
      zero++;
    else if (A[i] == 0)
      neg[make_pair(1, 0)]++;
    else if (B[i] == 0)
      pos[make_pair(1, 0)]++;
    else {
      long long g = gcd(A[i], B[i]);
      long long a = A[i] / g;
      long long b = B[i] / g;
      if (a < 0) {
        a *= -1;
        b *= -1;
      }
      if (b > 0)
        pos[make_pair(a, b)]++;
      else
        neg[make_pair(-b, a)]++;
    }
  }
  long long ans = 1;
  map<pair<long long, long long>, long long>::iterator p;
  for (p = pos.begin(); p != pos.end(); p++) {
    Map[make_pair(p->first.first, p->first.second)] +=
        modpow(2, p->second, 1000000007) - 1;
  }
  for (p = neg.begin(); p != neg.end(); p++) {
    Map[make_pair(p->first.first, p->first.second)] +=
        modpow(2, p->second, 1000000007) - 1;
  }
  for (p = Map.begin(); p != Map.end(); p++) {
    ans = ans * (p->second + 1) % 1000000007;
  }
  if (zero > 0) ans++;
  if (ans == 0) ans = 1000000007;
  ans--;
  cout << (ans) << endl;
  return 0;
}
