#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; }

#define int long long

typedef long long ll;

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

typedef pair <ll, ll> pr;

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

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;
  rep(i, 1, n) {
    ll x, y;
    scanf("%lld %lld", &x, &y);
    if (!x || !y) {
      cnt[pr(0, 1)]++; continue;
    }
    int sign = (x < 0) ^ (y < 0);
    ll g = __gcd(x = abso(x), y = abso(y));
    x /= g, y /= g;
    cnt[pr(x * (sign ? -1 : 1), y)]++;
  }
  int res = 1, tot = 0;
  for (auto p : cnt) {
    int s = p.second;
    if (p.first.first == 0) {
      tot = s;
      continue;
    }
    if (vis[p.first]) continue;
//    printf("(%lld %lld) %d\n", p.first.first, p.first.second, s);
    pr tmp = pr(p.first.second * (p.first.first < 0 ? 1 : -1), abso(p.first.first));
    res = 1ll * res * (qp(2, s) + qp(2, cnt[tmp]) - 1) % P;
    vis[tmp] = 1;
  }
  cout << (1ll * res + tot + P - 1) % P << endl;
}

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