#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  int N;
  cin >> N;
  map<pair<ll, ll>, ll> M;
  ll Z = 0;
  for (ll i = 0; i < (ll)(N); i++) {
    ll a, b;
    cin >> a >> b;
    if (a == 0 && b == 0)
      Z++;
    else if (a == 0 || b == 0) {
      if (a == 0)
        b = 1;
      else
        a = 1;
      if (M.count(make_pair(a, b)))
        M[make_pair(a, b)]++;
      else
        M[make_pair(a, b)] = 1;
    } else {
      ll tmp = gcd(a, b);
      a /= tmp;
      b /= tmp;
      if (a < 0 && b < 0) {
        a *= -1;
        b *= -1;
      }
      if (a > 0 && b < 0) {
        a *= -1;
        b *= -1;
      }
      if (M.count(make_pair(a, b)))
        M[make_pair(a, b)]++;
      else
        M[make_pair(a, b)] = 1;
    }
  }
  ll res = 1;
  set<pair<ll, ll>> seen;
  ll t = 0;
  for (auto p : M) {
    t++;
    ll a = p.first.first;
    ll b = p.first.second;
    ll c = p.second;
    seen.insert({a, b});
    ll tmp = pow(2, c) - 1;
    tmp %= 1000000007;
    if (a * b == 0) {
      a *= -1;
      b *= -1;
    }
    if (seen.count({-b, a})) continue;
    if (seen.count({b, -a})) continue;
    if (M.count({-b, a})) {
      seen.insert({-b, a});
      ll tmp2 = M[{-b, a}];
      tmp += (pow(2, M[{-b, a}]) - 1);
      tmp %= 1000000007;
    }
    if (M.count({b, -a})) {
      seen.insert({b, -a});
      ll tmp2 = M[{b, -a}];
      tmp += (pow(2, M[{b, -a}]) - 1);
      tmp %= 1000000007;
    }
    tmp++;
    res *= tmp;
    res %= 1000000007;
  }
  res = res + Z;
  if (t != 1) res--;
  res += 1000000007;
  res %= 1000000007;
  cout << res << endl;
}
