#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
ll gcd(ll x, ll y) {
  if (x % y == 0) return y;
  return gcd(y, x % y);
}
ll modn = 1000000007;
int main() {
  map<pair<ll, ll>, pair<ll, ll>> a;
  ll zero = 0;
  ll n;
  cin >> n;
  for (ll i = 0; i < n; i++) {
    ll x, y;
    cin >> x >> y;
    if (x == 0 && y == 0) {
      zero++;
      continue;
    }
    if (y < 0) x = -x, y = -y;
    if (y == 0 && x < 0) x = -x;
    ll g = abs(gcd(x, y));
    x /= g, y /= g;
    if (x <= 0)
      a[{y, -x}].second++;
    else
      a[{x, y}].first++;
  }
  ll ans = 0;
  ll tmp = 1;
  for (auto k : a) {
    ll tmp1 = 1;
    ll tmp2 = 1;
    for (ll i = 0; i < k.second.first; i++) {
      tmp1 *= 2;
      tmp1 %= modn;
    }
    tmp1 -= 1;
    for (ll i = 0; i < k.second.second; i++) {
      tmp2 *= 2;
      tmp2 %= modn;
    }
    tmp2 -= 1;
    ll r = ((tmp1 + tmp2) % modn + 1) % modn;
    tmp *= r;
    tmp %= modn;
  }
  ans += tmp;
  ans -= 1;
  ans += zero;
  ans %= modn;
  cout << ans << endl;
}
