#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int MOD = 1000000007;
long long gcd(long long a, long long b) {
  if (a < 0) a = -a;
  if (b < 0) b = -b;
  while (a != 0) {
    long long tmp = b % a;
    b = a;
    a = tmp;
  }
  return b;
}
long long pow_mod(long long a, long long n) {
  long long res = 1;
  while (n > 0) {
    if (n & 1) res = (res * a) % MOD;
    n >>= 1;
    a = (a * a) % MOD;
  }
  return res;
}
int main() {
  int n;
  cin >> n;
  int zero = 0;
  map<pair<ll, ll>, P> mp;
  for (int i = 0; i < n; i++) {
    ll a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      zero++;
      continue;
    }
    ll gcd_ab = gcd(a, b);
    a /= gcd_ab;
    b /= gcd_ab;
    if (b < 0)
      a = -a, b = -b;
    else if (b == 0 && a < 0)
      a = -a;
    if (a <= 0)
      mp[{b, -a}].first++;
    else
      mp[{a, b}].second++;
  }
  ll ans = 1;
  for (auto e : mp) {
    ll x = e.second.first, y = e.second.second;
    ans *= (pow_mod(2, x) + pow_mod(2, y) - 1 + MOD) % MOD;
    ans %= MOD;
  }
  ans--;
  ans += zero;
  ans %= MOD;
  cout << ans << endl;
  return 0;
}
