#include <bits/stdc++.h>
using namespace std;
map<pair<long long, long long>, long long> M;
long long d2[200010];
long long zc = 0;
long long gcd(long long x, long long y) {
  while (x) {
    y %= x;
    swap(x, y);
  }
  return y;
}
int main() {
  d2[0] = 1;
  for (int i = 1; i < 200010; i++) {
    d2[i] = d2[i - 1] * 2 % 1000000007;
  }
  long long N;
  long long g, c, d;
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> c >> d;
    if (c == 0 || d == 0) {
      zc++;
      continue;
    }
    g = gcd(abs(c), abs(d));
    c /= g;
    d /= g;
    if (c < 0) {
      c = -c;
      d = -d;
    }
    if (M.count({c, d}))
      M[{c, d}]++;
    else
      M.insert({{c, d}, 1});
  }
  pair<long long, long long> P;
  long long x, y, sa, fa = 1, cnt = 0;
  set<pair<long long, long long>> S;
  for (auto a : M) {
    tie(P, y) = a;
    if (S.count(P)) continue;
    tie(c, d) = P;
    swap(c, d);
    c = -c;
    if (c < 0) c = -c, d = -d;
    if (M.count({c, d})) {
      x = M[{c, d}];
      sa = d2[x] + d2[y] - 1LL;
      fa *= sa % 1000000007;
      fa %= 1000000007;
      S.insert({c, d});
    } else {
      cnt += y;
    }
  }
  fa *= zc + 1LL;
  fa %= 1000000007;
  fa *= d2[cnt];
  fa--;
  fa %= 1000000007;
  cout << fa << endl;
}
