#include <bits/stdc++.h>
using namespace std;
const long long M = 1e9 + 7;
long long n;
long long cnt;
long long ans = 1;
map<pair<long long, long long>, pair<long long, long long> > ma;
long long x, y;
long long gcd(long long p, long long q) {
  if (q == 0) return p;
  return gcd(q, p % q);
}
long long pow(long long p) {
  if (p == 0) return 1;
  long long t = pow(p / 2);
  if (p % 2 == 0)
    return t * t % M;
  else
    return t * t % M * 2 % M;
}
int main() {
  scanf("%lld", &n);
  for (long long i = 0; i < n; i++) {
    long long t1, t2;
    scanf("%lld%lld", &t1, &t2);
    if (t1 == 0 && t2 == 0) {
      cnt++;
      continue;
    } else if (t1 == 0) {
      x++;
      continue;
    } else if (t2 == 0) {
      y++;
      continue;
    }
    long long d = gcd(abs(t1), abs(t2));
    if (t1 * t2 > 0)
      ma[make_pair(abs(t1) / d, abs(t2) / d)].first++;
    else
      ma[make_pair(abs(t2) / d, abs(t1) / d)].second++;
  }
  ans *= (pow(x) + pow(y) + M - 1);
  ans %= M;
  for (auto it : ma) {
    ans *= (pow(it.second.first) + pow(it.second.second) + M - 1);
    ans %= M;
  }
  printf("%lld\n", ans + cnt - 1);
  return 0;
}
