#include <bits/stdc++.h>
using namespace std;

#define rep(i, a, b) for (int i = (a), i##end = (b); i <= i##end; ++i)
#define per(i, a, b) for (int i = (a), i##end = (b); i >= i##end; --i)

mt19937 Rnd(chrono::high_resolution_clock::now().time_since_epoch().count());

template <typename T>
inline void chkmax(T &x, T y) { if (x < y) x = y; }

template <typename T>
inline void chkmin(T &x, T y) { if (x > y) x = y; }

typedef long long ll;

const int P = 1e9 + 7;
int n;

typedef pair <ll, ll> pr;

map <pr, map <bool, int> > cnt;

ll abso(ll x) {
  return x < 0 ? -x : x;
}

int qp(int a, int k) {
  int res = 1;
  for (; k; k >>= 1, a = 1ll * a * a % P) {
    if (k & 1) res = 1ll * res * a % P;
  }
  return res;
}

void solve() {
  cin >> n;
  int res = 1, tot = 0;
  rep(i, 1, n) {
    ll x, y;
    scanf("%lld %lld", &x, &y);
    if (!x && !y) {
      tot++; continue;
    }
    int sign = (x < 0) ^ (y < 0);
    ll g = __gcd(x = abso(x), y = abso(y));
    x /= g, y /= g;
    cnt[sign ? pr(y, x) : pr(x, y)][sign]++;
  }
  for (auto p : cnt) {
    int x = cnt[p.first][0], y = cnt[p.first][1];
    res = 1ll * res * (qp(2, x) + qp(2, y) - 1) % P;
  }
  cout << (1ll * res + tot + P - 1) % P << endl;
}

signed main() {
//  int T = read();
//  while (T--) solve();
  solve();
  return 0;
}