#include <bits/stdc++.h>
using namespace std;
using lint = long long;


int main() {
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);

  int N;
  cin >> N;
  map<pair<lint, lint>, pair<lint, lint>> mp;
  lint zero = 0;

  for (int i = 0; i < N; i++) {
    lint A, B;
    cin >> A >> B;
    if (A == 0 && B == 0) {
      zero++;
      continue;
    }
    if (A == 0) {
      mp[{0, 1}].first++;
      continue;
    }
    if (B == 0) {
      mp[{1, 0}].second++;
      continue;
    }
    lint g = __gcd(abs(A), abs(B));
    A /= g;
    B /= g;
    if (abs(A) == abs(B)) {
      mp[{1, 1}].first++;
      continue;
    }
    int cur = 0;
    if (abs(A) > abs(B)) swap(A, B), A *= -1, cur = 1;
    if (B < 0) A *= -1, B *= -1;
    if (cur == 0) mp[{A, B}].first++;
    if (cur == 1) mp[{A, B}].second++;
  }

  const lint mod = 1e9 + 7;

  vector<lint> power(N + 1, 0);
  power[0] = 1;
  for (int i = 1; i <= N; i++) {
    power[i] = 2ll * power[i - 1] % mod;
  }

  lint ans = 1;
  for (auto i : mp) {
    if (i.first.first == i.first.second) {
      ans *= i.second.first + 1;
      continue;
    }
    // cout << i.second.first << " " << i.second.second << " a\n";
    ans *= power[i.second.first] + power[i.second.second] - 1;
    ans %= mod;
  }

  ans *= zero + 1;
  ans %= mod;

  ans--;
  ans += mod;
  ans %= mod;

  cout << ans << "\n";

}