#include <bits/stdc++.h>
using namespace std;
const long long MAX_N = 222222;
long long MOD = long long(1000000000 + 7);
long long fac2[MAX_N];
long long gcd(long long a, long long b) {
  if (a < b) {
    swap(a, b);
  }
  long long r = a % b;
  while (r != 0) {
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}
void init() {
  fac2[0] = 1ll;
  for (int i = 1; i < MAX_N; i++) {
    fac2[i] = fac2[i - 1] * 2ll % MOD;
  }
}
int main(void) {
  init();
  long long N;
  cin >> N;
  unordered_map<long long, int> umap;
  for (int i = 0; i < N; i++) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      long long p = 0;
      if (umap.count(p) == 0) {
        umap[p] = 1;
      } else {
        umap[p] += 1;
      }
      continue;
    }
    if (a == 0) {
      b = 1;
    }
    if (b == 0) {
      a = 1;
    }
    if (a == 0 || b == 0) {
      long long p = a * MAX_N + b;
      if (umap.count(p) == 0) {
        umap[p] = 1;
      } else {
        umap[p] += 1;
      }
      continue;
    }
    long long d = gcd(abs(a), abs(b));
    a /= d;
    b /= d;
    if (a < 0) {
      a *= -1;
      b *= -1;
    }
    long long p = a * MAX_N + b;
    if (b < 0) {
      p = 1 * MAX_N * MAX_N + a * MAX_N + b * -1;
    }
    if (umap.count(p) == 0) {
      umap[p] = 1;
    } else {
      umap[p] += 1;
    }
  }
  long long answer = 1;
  long long zero = 0;
  set<long long> searached;
  for (auto item : umap) {
    int n = item.second;
    long long f = item.first;
    int t = f / (MAX_N * MAX_N);
    long long a = (f % (MAX_N * MAX_N)) / MAX_N;
    long long b = f % MAX_N;
    if (t) b *= -1;
    if (searached.count(item.first) != 0) continue;
    searached.insert(item.first);
    long long a2 = 1;
    if (a == 0 && b == 0) {
      zero = n;
      continue;
    } else if (a == 0) {
      long long p = 1 * MAX_N;
      if (umap.count(p) != 0) {
        a2 = fac2[umap[p]];
      }
      searached.insert(p);
    } else if (b == 0) {
      long long p = 1;
      if (umap.count(p) != 0) {
        a2 = fac2[umap[p]];
      }
      searached.insert(p);
    } else {
      long long p = abs(b) * MAX_N + a;
      if (t == 0) p += 1 * MAX_N * MAX_N;
      if (umap.count(p) != 0) {
        a2 = fac2[umap[p]];
      }
      searached.insert(p);
    }
    answer *= (fac2[n] + a2 - 1);
    answer %= MOD;
  }
  cout << answer - 1 + zero << endl;
  return 0;
}
