#include <bits/stdc++.h>
using namespace std;
int N;
long long res = 1;
map<pair<long long, long long>, int> m;
long long gcd(long long a, long long b) { return a ? gcd(b % a, a) : b; }
long long pw(long long a, long long n) {
  long long ret = 1;
  while (n) {
    if (n & 1) ret = ret * a % 1000000007;
    a = a * a % 1000000007;
    n >>= 1;
  }
  return ret;
}
int main() {
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) {
    long long a, b;
    scanf("%lld %lld", &a, &b);
    if (a == 0 && b == 0) continue;
    long long g = gcd(a, b);
    a /= g;
    b /= g;
    if (b < 0) a = -a, b = -b;
    m[{a, b}]++;
  }
  while (!m.empty()) {
    auto it = *m.begin();
    long long a = it.first.first, b = it.first.second;
    int cnt = it.second;
    m.erase(m.begin());
    long long na = b, nb = -a;
    if (nb < 0) na = -na, nb = -nb;
    if (m.find({na, nb}) == m.end()) {
      res *= pw(2, cnt);
      res %= 1000000007;
    } else {
      int ncnt = m[{na, nb}];
      res *= (pw(2, cnt) + pw(2, ncnt) - 1) % 1000000007;
      res %= 1000000007;
      m.erase({na, nb});
    }
  }
  res--;
  res += 1000000007;
  res %= 1000000007;
  printf("%lld", res);
  return 0;
}
