#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll MOD = 1000000007;
ll mod = 998244353;
int inf = 1000001000;
ll INF = 1e18 + 5;
ll gcd(ll a, ll b) {
  ll temp;
  if (a < 0) a = -a;
  while (b != 0) {
    temp = b;
    b = a % b;
    a = temp;
  }
  return a;
}
int main() {
  ll n, ans = 2;
  cin >> n;
  vector<pair<ll, ll>> w(n);
  vector<ll> mul(n + 1, 0);
  for (int(i) = 0; (i) < (n); (i)++) {
    ll a, b;
    cin >> a >> b;
    if (b < 0) {
      a = -a;
      b = -b;
    }
    w[i] = make_pair(a, b);
  }
  ll c = 1;
  for (int(i) = 0; (i) < (n + 1); (i)++) {
    mul[i] = c;
    c = (c * 2) % MOD;
  }
  map<pair<ll, ll>, ll> m;
  ll A, B;
  ll cnt0 = 0;
  if (w[0].first == 0 || w[0].second == 0) {
    cnt0++;
  } else {
    tie(A, B) = w[0];
    ll g = gcd(A, B);
    ll a = (w[0].first) / g;
    ll b = (w[0].second) / g;
    if (m.count(make_pair(a, b)))
      m[make_pair(a, b)]++;
    else
      m[make_pair(a, b)] = 1;
  }
  for (int i = 1; i < n; i++) {
    if (w[i].first == 0 || w[i].second == 0) {
      ans = (ans + mul[i - cnt0] + MOD) % MOD;
      cnt0++;
    } else {
      ll g = gcd(w[i].first, w[i].second);
      ll a = w[i].first / g, b = w[i].second / g;
      if (a > 0 && m.count(make_pair(-b, a))) {
        ans = (ans + ans / mul[m[make_pair(-b, a)]] + MOD) % MOD;
      } else if (a < 0 && m.count(make_pair(b, -a))) {
        ans = (ans + ans / mul[m[make_pair(b, -a)]] + MOD) % MOD;
      } else {
        ans = (ans * 2) % MOD;
      }
      if (m.count(make_pair(a, b)))
        m[make_pair(a, b)]++;
      else
        m[make_pair(a, b)] = 1;
    }
  }
  cout << (ans + MOD - 1) % MOD << endl;
}
