#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const double PI = acos(-1);
ll gcd(ll a, ll b) {
  a = abs(a), b = abs(b);
  if (b == 0) return a;
  ll aa = a, bb = b;
  if (aa > bb) {
    ll temp = aa;
    aa = bb;
    bb = temp;
  }
  while (bb != 0) {
    ll temp = bb;
    bb = aa % bb;
    aa = temp;
  }
  return aa;
}
int main() {
  ll n;
  cin >> n;
  map<pair<ll, ll>, pair<ll, ll>> ab;
  ll zero = 0;
  for (ll i = 0; i < (n); ++i) {
    ll a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      zero++;
      continue;
    }
    ll abg = gcd(a, b);
    a /= abg, b /= abg;
    if (b < 0 || (b == 0 && a < 0)) {
      a = -a;
      b = -b;
    }
    if (a <= 0 && b > 0) {
      ll temp = a;
      a = b;
      b = -temp;
      ab[{a, b}].second++;
    } else {
      ab[{a, b}].first++;
    }
  }
  ll ans = 1;
  for (auto i : ab) {
    ans *= (pow(2, i.second.first) - 1 + pow(2, i.second.second) - 1 + 1);
    ans %= 1000000007;
  }
  ans -= 1;
  ans += zero;
  cout << ans << endl;
  return 0;
}
