#include <bits/stdc++.h>
using namespace std;
inline int read() {
  register int x = 0, f = 1;
  register 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();
  return x * f;
}
const int P = 1e9 + 7;
const int N = 2e5 + 5;
long long fsp(long long x, int y) {
  long long ans = 1;
  while (y) {
    if (y & 1) ans = ans * x % P;
    x = x * x % P, y >>= 1;
  }
  return ans;
}
long long gcd(long long a, long long b) {
  while (b) {
    long long t = b;
    b = a % b, a = t;
  }
  return a;
}
int n;
set<pair<long long, long long> > s;
long long a[N], b[N];
map<pair<long long, long long>, int> ma;
int cnt, cnt2, cnt3;
int main() {
  n = read();
  for (int i = 1; i <= n; i++) {
    a[i] = read(), b[i] = read();
    if (!a[i] || !b[i]) {
      if (a[i] == 0 && b[i] == 0)
        ++cnt;
      else if (a[i] == 0)
        ++cnt2;
      else if (b[i] == 0)
        ++cnt3;
      continue;
    }
    long long g = gcd(abs(a[i]), abs(b[i]));
    a[i] /= g, b[i] /= g;
    if (b[i] < 0) b[i] = -b[i], a[i] = -a[i];
  }
  long long ans = (fsp(2, cnt2) + fsp(2, cnt3) - 1) % P;
  for (int i = 1; i <= n; i++) ma[pair<long long, long long>(a[i], b[i])]++;
  for (int i = 1; i <= n; i++) {
    if (a[i] == 0 || b[i] == 0) continue;
    if (s.count(pair<long long, long long>(a[i], b[i]))) continue;
    long long x = -b[i], y = a[i];
    s.insert(pair<long long, long long>(a[i], b[i]));
    if (y < 0) y = -y, x = -x;
    if (s.count(pair<long long, long long>(x, y))) continue;
    ans = (ans * (fsp(2, ma[pair<long long, long long>(a[i], b[i])]) +
                  fsp(2, ma[pair<long long, long long>(x, y)]) - 1)) %
          P;
  }
  cout << (ans + cnt - 1 + P) % P;
  return 0;
}
