#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using ld = long double;
using pll = pair<ll, ll>;
const int mod = 1000000007;
struct mint {
  ll x;
  mint(ll x = 0) : x((x % mod + mod) % mod) {}
  mint operator-() const { return mint(-x); }
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod - a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const { return mint(*this) += a; }
  mint operator-(const mint a) const { return mint(*this) -= a; }
  mint operator*(const mint a) const { return mint(*this) *= a; }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t >> 1);
    a *= a;
    if (t & 1) a *= *this;
    return a;
  }
  mint inv() const { return pow(mod - 2); }
  mint& operator/=(const mint a) { return *this *= a.inv(); }
  mint operator/(const mint a) const { return mint(*this) /= a; }
};
mint f(int n) {
  if (n == 0) return 1;
  mint x = f(n / 2);
  x *= x;
  if (n % 2 == 1) x *= 2;
  return x;
}
mint choose(int n, int a) {
  mint x = 1, y = 1;
  for (int i = 0; i < a; ++i) {
    x *= n - i;
    y *= i + 1;
  }
  return x / y;
}
mint fact[200200];
mint inv_fact[200200];
void init() {
  fact[0] = 1;
  for (int i = 1; i < 200200; ++i) {
    fact[i] = fact[i - 1] * i;
  }
  inv_fact[200200 - 1] = fact[200200 - 1].inv();
  for (int i = 200200 - 1; i >= 1; --i) {
    inv_fact[i - 1] = inv_fact[i] * i;
  }
}
mint comb(ll n, ll k) {
  if (n < k)
    return 0;
  else
    return fact[n] * inv_fact[n - k] * inv_fact[k];
}
ll gcd(ll a, ll b) {
  if (a % b == 0) return b;
  return gcd(b, a % b);
}
int main() {
  init();
  int n;
  cin >> n;
  map<pll, P> mp;
  mint zero_cnt = 0;
  for (int i = 0; i < n; ++i) {
    ll a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      zero_cnt += 1;
      continue;
    }
    ll g = gcd(a, b);
    a /= g;
    b /= g;
    if ((b < 0) || (b == 0 && a < 0)) {
      a = -a;
      b = -b;
    }
    if (a <= 0) {
      swap(a, b);
      b = -b;
      ++mp[{a, b}].first;
    } else
      ++mp[{a, b}].second;
  }
  mint ans = 1;
  for (auto m : mp) {
    int s = m.second.first;
    int t = m.second.second;
    mint cur = 1;
    cur += f(s) - 1;
    cur += f(t) - 1;
    ans *= cur;
  }
  ans += zero_cnt;
  ans -= 1;
  cout << ans.x << endl;
  return 0;
}
