#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  for (; ch < '0' || ch > '9'; ch = getchar())
    if (ch == '-') f = -1;
  for (; ch >= '0' && ch <= '9'; ch = getchar())
    x = (x << 1) + (x << 3) + ch - '0';
  return x * f;
}
const long long N = 2e5 + 5;
const long long P = 1e9 + 7;
map<pair<long long, long long>, pair<long long, long long> > cnt;
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long Pow(long long x, long long t) {
  long long res = 1;
  for (; t; t >>= 1, x = x * x % P)
    if (t & 1) res = res * x % P;
  return res;
}
signed main() {
  long long n = read(), tot = P - 1;
  for (long long i = 1; i <= n; ++i) {
    long long a = read(), b = read();
    if (!a && !b) ++tot;
    long long g = gcd(a, b);
    a /= g;
    b /= g;
    if (b < 0) a = -a, b = -b;
    if (a > 0)
      ++cnt[{a, b}].first;
    else
      ++cnt[{b, -a}].second;
  }
  long long ans = 1;
  for (auto i : cnt)
    ans = ans * (Pow(2, i.second.first) + Pow(2, i.second.second) - 1) % P;
  printf("%lld\n", (ans + tot) % P);
  return 0;
}
