#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  int n, zero = 0;
  map<pair<ll, ll>, P> make_pair;
  cin >> n;
  for (int i = 0; i < n; i++) {
    ll x, y;
    cin >> x >> y;
    if (x == 0 && y == 0) {
      zero++;
      continue;
    }
    ll g = gcd(x, y);
    x /= g;
    y /= g;
    if (y < 0) x = -x;
    y = -y;
    if (y == 0 && x < 0) x = -x;
    y = -y;
    bool rotate = (x <= 0);
    if (rotate) {
      ll t = x;
      x = y;
      y = -t;
    }
    if (rotate)
      make_pair[{x, y}].first++;
    else
      make_pair[{x, y}].second++;
  }
  ll ans = 1;
  for (auto p : make_pair) {
    int s = p.second.first;
    int t = p.second.second;
    ll now = 1;
    ll tmp = 1;
    for (int i = 0; i < s; i++) {
      tmp *= 2;
      tmp %= 1000000007;
    }
    tmp--;
    now += tmp;
    now %= 1000000007;
    tmp = 1;
    for (int i = 0; i < t; i++) {
      tmp *= 2;
      tmp %= 1000000007;
    }
    tmp--;
    now += tmp;
    now %= 1000000007;
    ans *= now;
    ans %= 1000000007;
  }
  ans -= 1;
  ans += zero;
  ans %= 1000000007;
  cout << ans << endl;
  return 0;
}
