#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll gcd(ll a, ll b) {
  a = abs(a);
  b = abs(b);
  if (a < b) {
    return gcd(b, a);
  }
  ll r = a % b;
  if (r != 0) {
    return gcd(b, r);
  } else {
    return b;
  }
}
ll binary_power_divided(ll x, ll y, ll divider) {
  if (x == 1) {
    return 1;
  }
  ll retv = 1;
  ll x_pow_2i = x;
  ll temp_y = y;
  while (temp_y > 0) {
    if (temp_y % 2 == 1) {
      retv = (retv * x_pow_2i) % divider;
    }
    x_pow_2i = (x_pow_2i * x_pow_2i) % divider;
    temp_y /= 2;
  }
  return retv;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<ll> A(N), B(N);
  for (auto i = 0; i < N; ++i) {
    cin >> A[i] >> B[i];
  }
  map<pair<ll, ll>, pair<ll, ll>> ratio_num;
  ll zero_count;
  for (auto i = 0; i < N; ++i) {
    if (A[i] == 0 || B[i] == 0) {
      if ((A[i] == 0 && B[i] == 0)) {
        zero_count++;
      } else {
        if (ratio_num.count(make_pair(0, 1)) == 0) {
          ratio_num[make_pair(0, 1)] = make_pair(0, 0);
        }
        if (A[i] == 0) {
          ratio_num[make_pair(0, 1)].first++;
        } else {
          ratio_num[make_pair(0, 1)].second++;
        }
      }
      continue;
    }
    ll g = gcd(A[i], B[i]);
    ll a_r = A[i] / g;
    ll b_r = B[i] / g;
    if ((a_r > 0 && b_r > 0) || (a_r < 0 && b_r < 0)) {
      if (ratio_num.count(make_pair(abs(a_r), abs(b_r))) == 0) {
        ratio_num[make_pair(abs(a_r), abs(b_r))] = make_pair(0, 0);
      }
      ratio_num[make_pair(abs(a_r), abs(b_r))].first++;
    } else {
      if (ratio_num.count(make_pair(abs(b_r), abs(a_r))) == 0) {
        ratio_num[make_pair(abs(b_r), abs(a_r))] = make_pair(0, 0);
      }
      ratio_num[make_pair(abs(b_r), abs(a_r))].second++;
    }
  }
  ll ans = 1;
  for (const auto& [k, p] : ratio_num) {
    ans = (ans * ((1 + (binary_power_divided(2, p.first, 1000000007) - 1) +
                   (binary_power_divided(2, p.second, 1000000007) - 1)) %
                  1000000007)) %
          1000000007;
  }
  ans = (ans + 1000000007 + zero_count - 1) % 1000000007;
  (cout << (ans) << endl);
  return 0;
}
