#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool checkMin(T& a, T b) {
  return (a > b ? a = b, 1 : 0);
}
template <class T>
inline bool checkMax(T& a, T b) {
  return (a < b ? a = b, 1 : 0);
}
class Scanner {
 private:
  istream& ist;

 public:
  Scanner(istream& in) : ist(in) {}
  string next() {
    string r;
    ist >> r;
    return r;
  }
  string nextLine() {
    string r;
    getline(ist, r);
    return r;
  }
  long long nextInt() {
    long long r;
    ist >> r;
    return r;
  }
  double nextDouble() {
    double r;
    ist >> r;
    return r;
  }
};
Scanner sc(cin);
const long long MOD = 1000000007;
const long long N = 200005;
long long n;
pair<long long, long long> x[N];
void init() {
  scanf("%lld", &n);
  for (long long i = 0; i < n; i++) {
    long long a, b;
    scanf("%lld%lld", &a, &b);
    if (a < 0) {
      a = -a;
      b = -b;
    }
    x[i] = pair<long long, long long>(a, b);
  }
}
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
long long power(long long exp) {
  long long res = 1;
  while (exp--) (res *= 2) %= MOD;
  return res;
}
long long calc(long long u, long long v) {
  return (power(u) + power(v) - 1) % MOD;
}
void solve() {
  long long preans = 0;
  multiset<pair<long long, long long> > st0, st1;
  for (long long i = 0; i < n; i++) {
    long long g = gcd(abs(x[i].first), abs(x[i].second));
    x[i] = pair<long long, long long>(x[i].first / g, x[i].second / g);
    if (x[i].first == x[i].second && x[i].second == 0) {
      preans++;
      continue;
    }
    if (x[i].first == 0 || x[i].second == 0) {
      if (x[i].first == 0)
        st0.insert(pair<long long, long long>(0, 1));
      else
        st1.insert(pair<long long, long long>(0, 1));
      continue;
    }
    if (x[i].second > 0) {
      st0.insert(x[i]);
    } else if (x[i].second < 0) {
      st1.insert(pair<long long, long long>(-x[i].second, x[i].first));
    }
  }
  long long res = 1;
  while (!st0.empty()) {
    pair<long long, long long> it = *st0.begin();
    ;
    ;
    (res *= calc((long long)st0.count(it), (long long)st1.count(it))) %= MOD;
    st0.erase(it);
    st1.erase(it);
  }
  while (!st1.empty()) {
    pair<long long, long long> it = *st1.begin();
    ;
    ;
    (res *= calc((long long)st0.count(it), (long long)st1.count(it))) %= MOD;
    st0.erase(it);
    st1.erase(it);
  }
  printf("%lld\n", (res + preans - 1 + MOD) % MOD);
}
int main() {
  init();
  solve();
  return 0;
}
