#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 7;
const long long longinf = 1LL << 60;
const long long mod = 1e9 + 7;
const long double eps = 1e-10;
template <typename T1, typename T2>
inline void chmin(T1 &a, T2 b) {
  if (a > b) a = b;
}
template <typename T1, typename T2>
inline void chmax(T1 &a, T2 b) {
  if (a < b) a = b;
}
long long gcd(long long x, long long y) {
  if (x > y)
    return gcd(y, x);
  else if (x == 0)
    return y;
  else
    return gcd(y % x, x);
}
long long modpow(long long a, long long N) {
  long long ans = 1;
  long long tmp = a;
  while (N > 0) {
    if (N % 2 == 1) (ans *= tmp) %= mod;
    (tmp *= tmp) %= mod;
    N /= 2;
  }
  return ans;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<long long> A(n), B(n);
  map<pair<long long, long long>, long long> mp;
  long long zero = 0;
  for (int i = (int)(0); i < (int)(n); i++) {
    cin >> A[i] >> B[i];
    if (A[i] == 0 && B[i] == 0) {
      zero++;
    } else if (A[i] == 0) {
      mp[{0, 1}]++;
    } else if (B[i] == 0) {
      mp[{1, 0}]++;
    } else {
      long long g = gcd(abs(A[i]), abs(B[i]));
      A[i] /= g;
      B[i] /= g;
      if (A[i] < 0) {
        mp[{-A[i], -B[i]}]++;
      } else {
        mp[{A[i], B[i]}]++;
      }
    }
  }
  set<pair<long long, long long>> done;
  long long ans = 1;
  for (auto ele : mp) {
    long long a = ele.first.first;
    long long b = ele.first.second;
    if (!done.count({a, b})) {
      if (b > 0) {
        long long tmp =
            (modpow(2, ele.second) + modpow(2, mp[{b, -a}]) - 1) % mod;
        (ans *= tmp) %= mod;
        done.insert({a, b});
        done.insert({b, -a});
      } else {
        long long tmp =
            (modpow(2, ele.second) + modpow(2, mp[{-b, a}]) - 1) % mod;
        (ans *= tmp) %= mod;
        done.insert({a, b});
        done.insert({-b, a});
      }
    }
  }
  (ans += zero) %= mod;
  cout << (ans + mod - 1) % mod << '\n';
  return 0;
}
