#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll mod = 1e9 + 7;
long long mod_pow(long long a, long long b) {
  long long res = 1;
  a %= mod;
  while (b > 0) {
    if (b % 2 == 1) res = (res * a) % mod;
    a = (a * a) % mod;
    b /= 2;
  }
  return res;
}
long long mod_inv(long long a) { return mod_pow(a, mod - 2); }
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int n;
map<P, int> p;
vector<ll> p2;
P f(ll a, ll b) {
  if (a == 0)
    b = 1;
  else if (b == 0)
    a = 1;
  else {
    ll g = gcd(abs(a), abs(b));
    a /= g;
    b /= g;
    if (b < 0) {
      a *= -1;
      b *= -1;
    }
  }
  return P(a, b);
}
int main(void) {
  cin >> n;
  ll ans = 1;
  ll zero = 0;
  p2.assign(n + 1, 1);
  for (int i = 1; i <= n; i++) p2[i] = p2[i - 1] * 2 % mod;
  for (int i = 0; i < n; i++) {
    ll a, b;
    cin >> a >> b;
    p[f(a, b)]++;
  }
  while (!p.empty()) {
    auto itr = p.begin();
    P z = itr->first;
    int x = itr->second;
    int y = 0;
    ll a = z.first;
    ll b = z.second;
    auto itr2 = p.find(f(-b, a));
    if (itr2 != p.end()) {
      y = itr2->second;
      p.erase(itr2);
    }
    ans *= p2[x] + p2[y] - 1;
    ans %= mod;
    p.erase(itr);
  }
  ans += mod - 1;
  ans += zero;
  cout << ans % mod << endl;
}
