#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 < b) swap(a, b);
  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> MP;
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);
    if (A[i] == 0 || B[i] == 0) continue;
    long long G = GCD(abs(A[i]), abs(B[i]));
    A[i] /= G;
    B[i] /= G;
    MP[make_pair(A[i], B[i])]++;
  }
  vector<pair<int, int> > Count;
  long long ZeroA = 0, ZeroB = 0, Zero = 0;
  int Psize = 0;
  for (int i = 0; i < N; i++) {
    if (A[i] == 0 && B[i] == 0) {
      Zero++;
      continue;
    }
    if (A[i] == 0) {
      ZeroA++;
      continue;
    }
    if (B[i] == 0) {
      ZeroB++;
      continue;
    }
    P[Psize].first = (double)A[i] / (double)B[i];
    P[Psize].second = i;
    Psize++;
  }
  Count.push_back(make_pair(ZeroA, ZeroB));
  sort(P, P + Psize);
  int nowA = 1, nowB = 0;
  for (int i = 0; i < Psize; i++) {
    int now = P[i].second;
    if (visited[make_pair(A[now], B[now])]) continue;
    int cnt = 0;
    cnt +=
        MP[make_pair(-1 * B[now], A[now])] + MP[make_pair(B[now], -1 * A[now])];
    Count.push_back(make_pair(MP[make_pair(A[now], B[now])], cnt));
    visited[make_pair(A[now], B[now])] = true;
    visited[make_pair(-1 * B[now], A[now])] = true;
    visited[make_pair(B[now], -1 * A[now])] = true;
  }
  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;
  cout << ans << endl;
  return 0;
}
