#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll mod = 1e9 + 7;
using P = pair<ll, ll>;
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
ll Pow(ll x, ll n) {
  if (n == 0) return 1;
  if (n % 2 == 0)
    return Pow(x * x % mod, n / 2);
  else
    return x * Pow(x, n - 1) % mod;
}
P process(ll a, ll b) {
  P p;
  if (a * b > 0) {
    a = abs(a), b = abs(b);
    p = P(a / gcd(a, b), b / gcd(a, b));
  } else if (a * b < 0) {
    a = abs(a), b = abs(b);
    p = P(-a / gcd(a, b), b / gcd(a, b));
  } else {
    if (a == 0)
      p = P(0, 1);
    else
      p = P(1, 0);
  }
  return p;
}
int main() {
  ll n;
  cin >> n;
  ll z = 0;
  map<P, ll> m;
  vector<P> v;
  for (int i = 0; i < (int)n; i++) {
    ll x, y;
    cin >> x >> y;
    if (x == 0 && y == 0)
      z++;
    else {
      P p = process(x, y);
      v.push_back(p);
      m[p]++;
    }
  }
  ll ans = z;
  ll res = 1;
  for (auto x : v) {
    P y;
    if (x.first > 0)
      y = P(-x.second, x.first);
    else
      y = P(x.second, -x.first);
    (res *= (Pow(2, m[x]) + Pow(2, m[y]) - 1)) %= mod;
    m[x] = m[y] = 0;
  }
  res += mod - 1;
  (ans += res) %= mod;
  cout << ans << endl;
  return 0;
}
