#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
map<pair<ll, ll>, P> mp;
const ll MOD = 1000000007;
ll gcd(ll x, ll y) {
  if (y == 0) {
    return x;
  }
  return gcd(y, x % y);
}
int main() {
  int N;
  cin >> N;
  ll zero = 0;
  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;
    }
    bool rot90 = false;
    if (x <= 0) {
      rot90 = true;
      ll tmp = y;
      y = -x;
      x = tmp;
    }
    if (rot90) {
      mp[{x, y}].first++;
    } else {
      mp[{x, y}].second++;
    }
  }
  ll ans = 1;
  for (auto p : mp) {
    ll now = 1;
    now += (pow(2, p.second.first) - 1);
    now = now % MOD;
    now += (pow(2, p.second.second) - 1);
    now = now % MOD;
    ans *= now;
    ans = ans % MOD;
  }
  ans -= 1;
  ans += zero;
  cout << ans << endl;
  return 0;
}
