#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
ll power(ll x, ll n, ll m) {
  ll res = 1;
  if (n > 0) {
    res = power(x, n / 2, m);
    if (n % 2 == 0)
      res = (res * res) % m;
    else
      res = (((res * res) % m) * x) % m;
  }
  return res;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  map<pair<ll, ll>, ll> mp;
  for (int i = 0; i < n; i++) {
    ll a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) continue;
    if (b < 0) {
      a *= -1;
      b *= -1;
    }
    ll keepgcd = gcd(abs(a), abs(b));
    mp[make_pair(a / keepgcd, b / keepgcd)]++;
  }
  ll ans = 1;
  for (auto i : mp) {
    if (i.second == 0) continue;
    if (i.first.first == -1 && i.first.second == 0) {
      ll keep = 0;
      keep += power(2, i.second + mp[make_pair(1, 0)], MOD);
      if (mp[make_pair(0, 1)] > 0) {
        keep += power(2, mp[make_pair(0, 1)], MOD);
        keep--;
        mp[make_pair(0, 1)] = 0;
      }
      keep %= MOD;
      ans *= keep;
      ans %= MOD;
      mp[make_pair(1, 0)] = 0;
    } else {
      ll keep = 0;
      keep += power(2, i.second, MOD);
      if (mp[make_pair(i.first.second, -1 * i.first.first)] > 0) {
        keep +=
            power(2, mp[make_pair(i.first.second, -1 * i.first.first)], MOD);
        keep--;
        mp[make_pair(i.first.second, -1 * i.first.first)] = 0;
      }
      keep %= MOD;
      ans *= keep;
      ans %= MOD;
      mp[make_pair(i.first.first, i.first.second)] = 0;
    }
  }
  cout << (ans + MOD - 1) % MOD << '\n';
}
