#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long MOD2 = 998244353;
const long long MOD3 = 1812447359;
const long long INF = 1ll << 60;
const double PI = 2 * asin(1);
void yes() { printf("yes\n"); }
void no() { printf("no\n"); }
void Yes() { printf("Yes\n"); }
void No() { printf("No\n"); }
void YES() { printf("YES\n"); }
void NO() { printf("NO\n"); }
const double EPS = 1e-10;
int N;
long long A[int(2e5 + 5)], B[int(2e5 + 5)];
pair<double, int> P[int(2e5 + 5)];
long long GCD(long long a, long long b) {
  if (a == 0 && b == 0) return 1;
  if (a < b) swap(a, b);
  if (b == 0) return a;
  while (a % b != 0) {
    a %= b;
    swap(a, b);
  }
  return b;
}
long long Pow(long long a, long long n) {
  if (n == 0)
    return 1;
  else if (n % 2 == 0)
    return Pow(a * a % MOD, n / 2);
  else
    return a * Pow(a * a % MOD, n / 2) % MOD;
}
map<pair<long long, long long>, int> cnt;
map<pair<long long, long long>, bool> visited;
int main() {
  scanf("%d", &N);
  for (int i = 0; i < N; i++) {
    scanf("%lld%lld", A + i, B + i);
    long long G = GCD(abs(A[i]), abs(B[i]));
    A[i] /= G;
    B[i] /= G;
    if (A[i] < 0) A[i] *= -1, B[i] *= -1;
    cnt[make_pair(A[i], B[i])]++;
  }
  vector<pair<long long, long long> > Count;
  long long ZeroA = 0, ZeroB = 0, Zero = cnt[make_pair(0, 0)];
  visited[make_pair(0, 0)] = true;
  for (int i = 0; i < N; i++) {
    pair<long long, long long> P = make_pair(A[i], B[i]);
    if (visited[P]) continue;
    visited[P] = true;
    if (P.first == 0) {
      ZeroA += cnt[P];
      continue;
    }
    if (P.second == 0) {
      ZeroB += cnt[P];
      continue;
    }
    pair<long long, long long> next1 = make_pair(B[i], -1 * A[i]);
    Count.push_back(make_pair(cnt[P], cnt[next1]));
    visited[next1] = true;
  }
  Count.push_back(make_pair(ZeroA, ZeroB));
  long long ans = 1;
  for (int i = 0; i < Count.size(); i++) {
    long long now = Pow(2, Count[i].first) + Pow(2, Count[i].second) - 1;
    now %= MOD;
    ans *= now;
    ans %= MOD;
  }
  ans += Zero - 1;
  ans %= MOD;
  if (ans < 0) ans += MOD;
  printf("%lld\n", ans);
  return 0;
}
