#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
ll power(ll x, ll n, ll M = mod) {
  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 gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll n;
  cin >> n;
  ll ans = 0;
  map<pair<ll, ll>, ll> m;
  for (int i = 0; i < n; ++i) {
    ll a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      ans++;
      continue;
    }
    ll GCD = gcd(a, b);
    a /= GCD;
    b /= GCD;
    m[make_pair(a, b)]++;
  }
  n -= ans;
  ll y = 1;
  for (auto &&i : m) {
    if (i.first.first < 0 || i.first.second < 0) continue;
    if (i.first.first && !i.first.second) continue;
    ll x = m[make_pair(-i.first.second, i.first.first)] +
           m[make_pair(i.first.second, -i.first.first)];
    if (x > 0) {
      n -= i.second + x;
      y *= (power(2, i.second) - 1) + (power(2, x) - 1) + 1 + mod;
      y %= mod;
    }
  }
  y *= power(2, n);
  y %= mod;
  ans += y + mod - 1;
  ans %= mod;
  cout << ans << endl;
}
