#include <bits/stdc++.h>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
using ll = long long;
using ld = long double;
constexpr long long mod = 1e9 + 7;
constexpr long long Mod = 998244353;
constexpr long long MXN = 500000 + 100;
constexpr ld EPS = 1e-10;
constexpr ll inf = 3 * 1e18;
constexpr long long Inf = 15 * 1e8;
const vector<long long> dx{-1, 1, 0, 0}, dy{0, 0, -1, 1};
template <class T>
bool chmax(T& a, const T& b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T& a, const T& b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
ll read() {
  ll u, k = scanf("%lld", &u);
  return u;
}
string reads() {
  string s;
  cin >> s;
  return s;
}
pair<long long, long long> readh(bool g = 0) {
  pair<long long, long long> u;
  long long k = scanf("%lld %lld", &u.first, &u.second);
  if (g) u.first--, u.second--;
  return u;
}
bool inarea(pair<long long, long long> t, long long h, long long w) {
  return 0 <= t.first && t.first < h && 0 <= t.second && t.second < w;
}
ll gcd(ll i, ll j) { return j ? gcd(j, i % j) : i; }
ll mod_pow(ll x, ll n, ll p = mod) {
  ll res = 1;
  x %= p;
  while (n > 0) {
    if (n & 1) res = res * x % p;
    x = x * x % p;
    n >>= 1;
  }
  return res;
}
ll bitcount(ll x) {
  long long sum = 0;
  for (long long i = 0; i < 60; i++)
    if ((1ll << i) & x) sum++;
  return sum;
}
constexpr long long fn_ = 5000005;
ll fact_[fn_], comp_[fn_];
ll comb(ll x, ll y, ll m) {
  if (!fact_[0]) {
    fact_[0] = 1;
    comp_[0] = 1;
    for (long long i = 1; i < fn_; i++) fact_[i] = fact_[i - 1] * i % m;
    comp_[fn_ - 1] = mod_pow(fact_[fn_ - 1], m - 2, m);
    for (long long i = fn_ - 2; i > 0; i--)
      comp_[i] = comp_[i + 1] * (i + 1) % m;
  }
  if (x < y) return 0;
  return fact_[x] * comp_[x - y] % m * comp_[y] % m;
}
signed main() {
  long long n;
  cin >> n;
  vector<pair<long long, long long> > a;
  map<pair<long long, long long>, long long> mp;
  long long sum = 0;
  set<pair<long long, long long> > se;
  for (long long i = (0); i < ((n)); i++) {
    a.emplace_back(readh());
    if (a[i] == pair<long long, long long>{0, 0}) {
      sum++;
      continue;
    }
    if (a[i].second == 0) {
      mp[pair<long long, long long>{1, 0}]++;
      continue;
    } else if (a[i].first == 0) {
      mp[pair<long long, long long>{0, 1}]++;
      continue;
    }
    long long g = gcd(abs(a[i].first), abs(a[i].second));
    a[i].first /= g, a[i].second /= g;
    if (a[i].second < 0) a[i].first *= -1, a[i].second *= -1;
    mp[a[i]]++;
  }
  long long ans = 1;
  for (auto g : mp) {
    pair<long long, long long> t = g.first;
    if (t.first * t.second == 0) {
      swap(t.first, t.second);
    } else {
      swap(t.first, t.second);
      if (t.first > 0 && t.second > 0)
        t.first *= -1;
      else
        t.first = abs(t.first), t.second = abs(t.second);
    }
    ans *= (mod_pow(2, mp[t], mod) + mod_pow(2, g.second, mod) - 1) % mod;
    mp[t] = 0, mp[g.first] = 0;
    ans %= mod;
    (ans += mod) %= mod;
  }
  if (sum > 0) exit(1);
  cout << ans + sum - 1 << endl;
}
