#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
template <typename T>
auto compare = [](T x, T y) -> bool { return (x < y); };
const int MOD = 1000000007;
long long gcd(long long a, long long b) {
  while (a != 0 && b != 0) {
    if (a >= b)
      a %= b;
    else
      b %= a;
  }
  return a + b;
}
int N;
ll A[100010], B[100010];
ll P[100010];
signed main() {
  cin >> N;
  for (int(i) = 0; (i) < (N); ++(i)) {
    cin >> A[i] >> B[i];
    if (A[i] < 0) {
      A[i] *= -1;
      B[i] *= -1;
    }
    ll g = gcd(abs(A[i]), abs(B[i]));
    A[i] /= g;
    B[i] /= g;
  }
  P[0] = 1;
  for (int(i) = 0; (i) < (N); ++(i)) P[i + 1] = 2 * P[i] % MOD;
  map<pll, pll> mp;
  ll z = MOD - 1;
  for (int(i) = 0; (i) < (N); ++(i)) {
    if (A[i] == 0 && B[i] == 0) {
      z++;
      continue;
    }
    if (B[i] > 0)
      mp[pll(A[i], B[i])].first++;
    else
      mp[pll(-B[i], A[i])].second++;
  }
  ll ans = 1;
  for (auto p : mp) {
    int a = p.second.first, b = p.second.second;
    ans = ans * (P[a] + P[b] - 1) % MOD;
  }
  cout << ((z + ans) % MOD) << "\n";
  return 0;
}
