#include <bits/stdc++.h>
#pragma GCC target( \
    "sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("unroll-loops")
using namespace std;
const long double EPS = 0.001;
const long double EPS2 = 1e-6;
const long double PI = acos(-1);
const int MOD7 = 1000000007;
const int MOD9 = 1000000009;
const int a228 = 18;
const int inf = 1e9;
const long long kekmod = 1791791791;
const long long bestmod = 1148822869;
long long gcd(long long a, long long b) {
  while (b) {
    a %= b;
    swap(a, b);
  }
  return a;
}
const long long mod = MOD7;
long long mul(long long a, long long b) { return a * b % mod; }
long long add(long long a, long long b) {
  a += b;
  if (a >= mod) a -= mod;
  if (a < 0) a += mod;
  return a;
}
const long long MAXN = 228228;
long long binpow(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) {
      res = mul(res, a);
    }
    a = mul(a, a);
    b >>= 1;
  }
  return res;
}
long long inv(long long x) { return binpow(x, mod - 2); }
pair<pair<long long, long long>, bool> invv(pair<long long, long long> a) {
  pair<pair<long long, long long>, bool> ta;
  a.first = -a.first;
  ta.first = {a.second, a.first};
  ta.second = (a.first < 0);
  ta.first = {abs(a.second), abs(a.first)};
  return ta;
}
pair<pair<long long, long long>, bool> tget(pair<long long, long long> a) {
  pair<pair<long long, long long>, bool> ta;
  ta.first = a;
  ta.second = (ta.first.first < 0);
  ta.first = {abs(ta.first.first), abs(ta.first.second)};
  return ta;
}
long long pss[MAXN];
signed main() {
  ios_base::sync_with_stdio(0);
  cout.tie(0);
  cin.tie(0);
  srand(time(NULL));
  map<pair<pair<long long, long long>, bool>, long long> cnt;
  long long n;
  cin >> n;
  vector<pair<long long, long long>> a(n);
  for (long long i = 0; i < n; ++i) {
    cin >> a[i].first >> a[i].second;
  }
  pss[0] = 1;
  for (long long i = 1; i < MAXN; ++i) {
    pss[i] = mul(pss[i - 1], 2);
  }
  pss[0] = 0;
  for (long long i = 1; i < MAXN; ++i) {
    pss[i] = add(pss[i], -1);
  }
  long long amul = 1;
  long long ans = 0;
  for (long long i = 0; i < n; ++i) {
    if (a[i].first == 0 && a[i].second == 0) {
      ans = add(ans, 1);
      continue;
    }
    long long gg = gcd(abs(a[i].first), abs(a[i].second));
    a[i].first /= gg;
    a[i].second /= gg;
    bool f1 = (a[i].first < 0);
    bool f2 = (a[i].second < 0);
    a[i].first = abs(a[i].first);
    a[i].second = abs(a[i].second);
    if (f1 ^ f2) {
      a[i].first = -a[i].first;
    }
    auto ta = a[i];
    auto tkek = invv(ta);
    if (a[i].first == 0) {
      auto tamul = amul;
      tamul = mul(tamul,
                  inv(1 + cnt[{tkek.first, 0}] +
                      cnt[invv({abs(tkek.first.first), tkek.first.second})]));
      tamul = mul(tamul,
                  inv(1 + cnt[{tkek.first, 1}] +
                      cnt[invv({-abs(tkek.first.first), tkek.first.second})]));
      ans = add(ans, tamul);
    } else
      ans = add(ans, mul(amul, mul(add(1, pss[cnt[tkek]]),
                                   inv(add(1, add(pss[cnt[tget(a[i])]],
                                                  pss[cnt[tkek]]))))));
    amul = mul(amul, inv(add(add(1, pss[cnt[tget(a[i])]]), pss[cnt[tkek]])));
    cnt[tkek]++;
    amul = mul(amul, (add(add(1, pss[cnt[tget(a[i])]]), pss[cnt[tkek]])));
  }
  cout << ans;
}
