#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void read(T &x) {
  x = 0;
  int f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') x = x * 10 + (ch ^ 48), ch = getchar();
  x *= f;
  return;
}
template <typename T>
void write(T x) {
  if (x < 0) putchar('-'), x = -x;
  if (x >= 10) write(x / 10);
  putchar(x % 10 + '0');
  return;
}
const int MAXN = 200010;
int n;
long long a[MAXN], b[MAXN];
long long c[MAXN], d[MAXN];
map<pair<long long, long long>, int> mp;
map<pair<long long, long long>, bool> book;
long long gcd(register int x, register int y) {
  return y == 0 ? x : gcd(y, x % y);
}
long long ans = 1;
long long p[MAXN];
int main() {
  read(n);
  for (register int i = 1; i <= n; ++i) {
    read(a[i]), read(b[i]);
    long long x = a[i], y = b[i], p = gcd(abs(a[i]), abs(b[i]));
    if (x == 0 && y == 0)
      mp[make_pair(0, 0)]++, c[i] = 0, d[i] = 0;
    else if (x == 0)
      mp[make_pair(0, 1)]++, c[i] = 0, d[i] = 1;
    else if (y == 0)
      mp[make_pair(-1, 0)]++, c[i] = -1, d[i] = 0;
    else {
      if (x * y < 0)
        y = abs(y), x = -abs(x);
      else if (x < 0 && y < 0)
        x = -x, y = -y;
      x /= p, y /= p;
      mp[make_pair(x, y)]++;
      c[i] = x, d[i] = y;
    }
  }
  p[0] = 1;
  for (register int i = 1; i <= n; ++i) p[i] = p[i - 1] * 2, p[i] %= 1000000007;
  for (register int i = 0; i <= n; ++i) --p[i];
  for (register int i = 1; i <= n; ++i)
    if (!book[make_pair(c[i], d[i])]) {
      long long x = c[i], y = d[i];
      if (x < 0)
        ans *= p[mp[make_pair(y, -x)]] + p[mp[make_pair(x, y)]] + 1,
            ans %= 1000000007,
            book[make_pair(x, y)] = book[make_pair(y, -x)] = 1;
      else if (x == 0 && y == 0)
        book[make_pair(x, y)] = 1;
      else
        ans *= p[mp[make_pair(x, y)]] + p[mp[make_pair(-y, x)]] + 1,
            ans %= 1000000007,
            book[make_pair(x, y)] = book[make_pair(-y, x)] = 1;
    }
  ans += mp[make_pair(0, 0)];
  write(ans - 1), putchar('\n');
  return 0;
}
