#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
__int128 gcd(__int128 a, __int128 b) {
  if (!b) return a;
  return gcd(b, a % b);
}
struct A {
  __int128 a, b;
  void red() {
    __int128 c = gcd(a, b);
    a /= c;
    b /= c;
  }
  A(long long aa, long long bb) {
    if (bb < 0) aa *= -1, bb *= -1;
    a = aa, b = bb;
    red();
  }
  bool operator<(const A& o) const { return a * o.b < o.a * b; }
  bool operator==(const A& o) const { return (a == o.a) && (b == o.b); }
};
map<A, int> mp;
long long bp(long long a, long long b) {
  long long i, ans = 1, res = a;
  for (i = 1; i <= b; i <<= 1, res = res * res % mod) {
    if (i & b) ans = ans * res % mod;
  }
  return ans;
}
int main() {
  int n;
  scanf("%d", &n);
  long long first = 0, second = 0;
  for (int i = (1); i <= (n); ++i) {
    long long a, b;
    scanf("%lld %lld", &a, &b);
    if (a == 0 && b == 0) continue;
    if (a == 0) {
      ++first;
      continue;
    }
    if (b == 0) {
      ++second;
      continue;
    }
    mp[A(a, b)]++;
  }
  long long ans = 1;
  map<A, int>::iterator it2, it;
  for (it2 = mp.begin(); it2 != mp.end(); it2++) {
    auto e = (*it2);
    long long res = bp(2, e.second);
    it = mp.find(A(-e.first.b, e.first.a));
    if (it != mp.end()) res += bp(2, it->second) - 1, res %= mod, mp.erase(it);
    ans = ans * (res) % mod;
  }
  long long res = 0;
  ans = ans * ((bp(2, second) + bp(2, first) - 1) % mod) % mod;
  ans = (ans + mod - 1) % mod;
  printf("%lld", ans);
  return 0;
}
