#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using pll = pair<long long, long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;
ll gcd(ll a, ll b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long modpow(long long x, long long n) {
  long long ret = 1;
  while (n > 0) {
    if (n & 1) ret = (ret * x) % MOD;
    x = (x * x) % MOD;
    n >>= 1;
  }
  return ret;
}
int main() {
  int n;
  cin >> n;
  vector<pll> ab(n);
  for (ll i = 0; i < (ll)(n); i++) {
    cin >> ab[i].first >> ab[i].second;
    ll g = gcd(ab[i].first, ab[i].second);
    if (g == 0LL) continue;
    ab[i].first /= g;
    ab[i].second /= g;
    if (ab[i].second < 0) {
      ab[i].first = -ab[i].first;
      ab[i].second = -ab[i].second;
    }
  }
  map<pll, P> mp;
  ll cnt = 0;
  for (ll i = 0; i < (ll)(n); i++) {
    if (ab[i].first == 0 && ab[i].second == 0) ++cnt;
    if (ab[i].first < 0) {
      mp[pll(ab[i].second, -ab[i].first)].second++;
    } else {
      mp[ab[i]].first++;
    }
  }
  ll ans = 1;
  for (auto p : mp) {
    ans = (ans * (modpow(2, p.second.first) + modpow(2, p.second.second) - 1)) %
          MOD;
    cout << p.second.first << "  " << p.second.second << endl;
  }
  cout << ans + cnt - 1 << endl;
  return 0;
}
