#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000007;
long long gcd(long long a, long long b) {
  a = abs(a);
  b = abs(b);
  if (a < b) swap(a, b);
  long long r;
  while (b) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
long long modpow(long long a, long long n) {
  long long r = 1;
  while (n) {
    if (n % 2) r = r * a % MOD;
    a = a * a % MOD;
    n /= 2;
  }
  return r;
}
int main() {
  int N;
  cin >> N;
  int Z = 0;
  map<pair<long long, long long>, pair<long long, long long>> mp;
  for (int i = 0; i < (N); i++) {
    long long A, B;
    cin >> A >> B;
    if (A == 0 && B == 0)
      Z++;
    else if (A == 0) {
      mp[{0, 0}].first++;
    } else if (B == 0) {
      mp[{0, 0}].second++;
    } else {
      long long g = gcd(A, B);
      A = A / g;
      B = B / g;
      if (B < 0) {
        A = -A;
        B = -B;
      }
      if (A < 0)
        mp[{B, -A}].first++;
      else
        mp[{A, B}].second++;
    }
  }
  long long ans = Z + 1;
  for (auto m : mp) {
    long long tmp = modpow(2, m.second.first) + modpow(2, m.second.second) - 1;
    ans = (ans * tmp) % MOD;
  }
  cout << ans - 1 << endl;
  return 0;
}
