#include <bits/stdc++.h>
using namespace std;
int N;
int pw2[200001];
long long A, B;
map<pair<long long, long long>, pair<int, int> > track;
long long gcd(long long a, long long b) {
  while (a != 0 && b != 0) {
    if (a > b)
      a = a % b;
    else
      b = b % a;
  }
  if (a == 0)
    return b;
  else
    return a;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> N;
  pw2[0] = 1;
  for (int i = (1); i < (N + 1); i++)
    pw2[i] = ((int)(((long long)(pw2[i - 1]) * (2)) % 1000000007));
  int zA = 0, zB = 0, zz = 0;
  for (int i = (0); i < (N); i++) {
    cin >> A >> B;
    if (!A || !B) {
      if (!A && !B)
        zz++;
      else if (!A)
        zA++;
      else if (!B)
        zB++;
      continue;
    }
    long long C = gcd(abs(A), abs(B));
    A /= C;
    B /= C;
    if (track.count(make_pair(-A, -B)))
      track[make_pair(-A, -B)].first++;
    else if (track.count(make_pair(-B, A)))
      track[make_pair(-B, A)].second++;
    else if (track.count(make_pair(B, -A)))
      track[make_pair(B, -A)].second++;
    else
      track[make_pair(A, B)].first++;
  }
  int ans = 1;
  ans = ((int)(((long long)(ans) *
                (((int)(((long long)(zz + 1) *
                         (((int)(((long long)((
                                      (int)(((long long)(pw2[zA]) + (pw2[zB])) %
                                            1000000007))) +
                                  (1000000007 - 1)) %
                                 1000000007)))) %
                        1000000007)))) %
               1000000007));
  for (auto it = track.begin(); it != track.end(); it++) {
    ans = ((int)(((long long)(ans) *
                  (((int)(((long long)((
                               (int)(((long long)(pw2[(it->second).first]) +
                                      (pw2[(it->second).second])) %
                                     1000000007))) +
                           (1000000007 - 1)) %
                          1000000007)))) %
                 1000000007));
  }
  cout << ((int)(((long long)(ans) + (1000000007 - 1)) % 1000000007)) << '\n';
}
