#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 4;
const long long MOD = 1000000007;
int n;
map<pair<long long, long long>, int> mp;
int cnt[N];
bool vis[N];
int tot;
pair<long long, long long> p[N];
long long ans = 1;
inline long long gcd(long long a, long long b) {
  return !b ? a : gcd(b, a % b);
}
inline long long fpow(long long a, long long b) {
  long long ret = 1;
  while (b) {
    if (b & 1) ret = ret * a % MOD;
    b >>= 1, a = a * a % MOD;
  }
  return ret;
}
int main() {
  scanf("%d", &n);
  for (register int i = 1; i <= n; ++i) {
    long long x, y;
    scanf("%lld%lld", &x, &y);
    if (x == 0 && y)
      y = 1;
    else if (y == 0 && x)
      x = 1;
    else if (x && y) {
      long long d = gcd(x, y);
      x /= d, y /= d;
      if (x < 0 && y > 0) x = -x, y = -y;
    }
    pair<long long, long long> cur = make_pair(x, y);
    if (!mp.count(cur)) {
      p[++tot] = cur;
      mp[cur] = tot;
      cnt[tot] = 1;
    } else
      ++cnt[mp[cur]];
  }
  for (register int i = 1; i <= tot; ++i) {
    if (vis[i] || (!p[i].first && !p[i].second)) continue;
    pair<long long, long long> cur = p[i];
    long long x = cur.first, y = cur.second, fac = fpow(2, cnt[i]);
    long long x1 = -y, y1 = x;
    if (x1 == 0)
      y1 = 1;
    else if (y1 == 0)
      x1 = 1;
    else if (x1 < 0 && y1 > 0)
      x1 = -x1, y1 = -y1;
    pair<long long, long long> rev = make_pair(x1, y1);
    if (mp.count(rev)) {
      vis[mp[rev]] = true;
      fac = (fpow(2, cnt[i]) + fpow(2, cnt[mp[rev]]) - 1) % MOD;
    } else {
      fac = fpow(2, cnt[i]);
    }
    (ans *= fac) %= MOD;
  }
  pair<long long, long long> nul = make_pair(0, 0);
  if (mp.count(nul)) (ans += cnt[mp[nul]]) %= MOD;
  printf("%lld\n", ans - 1);
  return 0;
}
