#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9 + 6;
const long long MOD = 1e9 + 7;
const long long LLINF = 1e18;
long long gcd(long long a, long long b) {
  if (a < b) swap(a, b);
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long modpow(long long a, long long n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % MOD;
    a = a * a % MOD;
    n >>= 1;
  }
  return res;
}
pair<long long, long long> rev(pair<long long, long long> a) {
  if (a.first >= 0)
    return make_pair(-a.second, a.first);
  else
    return make_pair(a.second, -a.first);
}
int main() {
  int N;
  cin >> N;
  long long A[N], B[N];
  pair<long long, long long> iwashi[N];
  map<pair<long long, long long>, long long> dis;
  long long ans = 1;
  for (int i = int(0); i < int(N); i++) {
    cin >> A[i] >> B[i];
    if (A[i] == 0 || B[i] == 0) {
      if (A[i] == 0 && B[i] == 0) {
        iwashi[i].first = 0;
        iwashi[i].second = 0;
      } else if (A[i] == 0) {
        iwashi[i].first = 0;
        iwashi[i].second = 1;
      } else {
        iwashi[i].first = -1;
        iwashi[i].second = 0;
      }
    } else {
      long long GCD = gcd(abs(A[i]), abs(B[i]));
      if (B[i] < 0) {
        A[i] *= -1;
        B[i] *= -1;
      }
      iwashi[i].first = A[i] / GCD;
      iwashi[i].second = B[i] / GCD;
    }
    dis[iwashi[i]]++;
  }
  for (auto itr = dis.begin(); itr != dis.end(); ++itr) {
    if ((itr->first).first == 0 && (itr->first).second == 0) {
      ans = (ans + dis[itr->first]) % MOD;
    } else {
      ans =
          (ans *
           ((modpow(2, dis[rev(itr->first)]) + modpow(2, dis[itr->first]) - 1) %
            MOD)) %
          MOD;
      dis[rev(itr->first)] = 0;
      dis[itr->first] = 0;
    }
  }
  cout << ans - 1 << endl;
}
