#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
const int mod = 1e9 + 7;
ll gcd(ll a, ll b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
ll me(ll x, ll n) {
  ll res = 1;
  while (n) {
    if (n & 1) res = (res * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return res;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  map<pll, ll> ma;
  ll az = 0, xz = 0, yz = 0;
  for (int i = 0; i < n; i++) {
    ll a, b;
    cin >> a >> b;
    if (a == 0 and b == 0)
      az++;
    else if (a == 0)
      xz++;
    else if (b == 0)
      yz++;
    else {
      pll pp;
      int g = gcd(abs(a), abs(b));
      a /= g;
      b /= g;
      int sa = a / abs(a), sb = b / abs(b);
      if (a < 0) a *= -1;
      if (b < 0) b *= -1;
      if (sa * sb < 0)
        pp = {-a, b};
      else
        pp = {a, b};
      if (ma.count(pp))
        ma[pp]++;
      else
        ma[pp] = 1;
    }
  }
  ll other = 1, ans = 0;
  for (auto& i : ma) {
    pll pp = i.first, req;
    if (pp.first < 0)
      req = {pp.second, -pp.first};
    else
      req = {-pp.second, pp.first};
    ll cnt1 = i.second, cnt2 = 0;
    if (ma.count(req)) cnt2 = ma[req], ma[req] = 0, i.second = 0;
    ll contribution = (me(2, cnt1) + me(2, cnt2) - 1 + mod) % mod;
    other = (other * contribution) % mod;
  }
  ans = (other - 1 + mod) % mod;
  ll temp = (me(2, xz) - 1 + mod) % mod;
  temp = (other * temp) % mod;
  ans = (ans + temp) % mod;
  temp = (me(2, yz) - 1 + mod) % mod;
  temp = (temp * other) % mod;
  ans = (ans + temp) % mod;
  ans = (ans + az) % mod;
  cout << ans << '\n';
  return 0;
}
