#include <bits/stdc++.h>
using namespace std;
const long long N = 200010, M = 1e9 + 7;
struct kk {
  long long a, b;
  bool operator<(const kk &x) const {
    if (a != x.a)
      return a < x.a;
    else
      return b < x.b;
  }
};
struct KK {
  long long pos, neg;
};
map<kk, KK> m;
set<kk> s;
set<kk>::iterator iter;
long long n;
long long oa, ob, o, ans;
long long gcd(long long a, long long b) {
  if (b > a) swap(a, b);
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long ex(long long b, long long e, long long m) {
  if (e == 0) return 1;
  long long tmp = ex(b, e >> 1, m);
  if (e & 1)
    return tmp * tmp % m * b % m;
  else
    return tmp * tmp % m;
}
int main() {
  scanf("%lld", &n);
  for (long long i = 1, a, b; i <= n; ++i) {
    scanf("%lld %lld", &a, &b);
    if (a == 0 && b == 0)
      ++o;
    else if (a == 0)
      ++ob;
    else if (b == 0)
      ++oa;
    else {
      long long e = gcd(abs(a), abs(b));
      a /= e, b /= e;
      if (a < 0) a = -a, b = -b;
      if (b > 0) {
        ++m[(kk){a, b}].pos;
        s.insert((kk){a, b});
      } else {
        ++m[(kk){-b, a}].neg;
        s.insert((kk){-b, a});
      }
    }
  }
  ans = ex(2, oa, M) + ex(2, ob, M) - 1;
  ans %= M;
  for (iter = s.begin(); iter != s.end(); ++iter) {
    kk tmp = *iter;
    long long cho;
    cho = ex(2, m[tmp].pos, M) + ex(2, m[tmp].neg, M) - 1;
    cho %= M;
    ans *= cho;
    ans %= M;
  }
  if (ans)
    printf("%lld\n", ans - 1);
  else
    printf("%lld\n", M - 1);
}
