#include <bits/stdc++.h>
using namespace std;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
int64_t g(int64_t a, int64_t b) {
  int64_t c = max(a, b);
  int64_t d = min(a, b);
  if (d == 1) return 1;
  if (d == 0) return 0;
  if (c == d) return c;
  return g(c - d, d);
}
int main() {
  int n;
  cin >> n;
  map<pair<int64_t, int64_t>, int> s;
  bool check0 = 0;
  for (int i = 0; i < (int)(n); i++) {
    int64_t a;
    int64_t b;
    cin >> a >> b;
    int64_t aze = max(a, -a);
    int64_t bze = max(b, -b);
    int64_t gcd = g(aze, bze);
    if (gcd != 0) {
      a = a / gcd;
      b = b / gcd;
    }
    if (a == 0 && b == 0) {
      check0 = 1;
      continue;
    }
    if (a == 0) b = -1;
    if (b == 0) a = 1;
    if (a < 0) {
      a = -a;
      b = -b;
    }
    if (s.count(make_pair(a, b)))
      s[make_pair(a, b)]++;
    else
      s[make_pair(a, b)] = 1;
  }
  int64_t ans = 1;
  for (auto p : s) {
    if (p.first.second < 0) {
      if (s.count(make_pair((-1) * p.first.second, p.first.first))) {
        int64_t ha = 1;
        int64_t ma = 1;
        for (int i = 0;
             i < (int)(s[make_pair((-1) * p.first.second, p.first.first)]);
             i++) {
          ha *= 2;
          ha %= 1000000007;
        }
        for (int i = 0; i < (int)(s[p.first]); i++) {
          ma *= 2;
          ma %= 1000000007;
        }
        ans *= (ha + ma - 1);
        s.erase(make_pair((-1) * p.first.second, p.first.first));
        s.erase(p.first);
      } else {
        for (int i = 0; i < (int)(s[p.first]); i++) {
          ans *= 2;
          ans %= 1000000007;
        }
        s.erase(p.first);
      }
    } else {
      if (s.count(make_pair(p.first.second, (-1) * p.first.first))) {
        int64_t ha = 1;
        int64_t ma = 1;
        for (int i = 0;
             i < (int)(s[make_pair(p.first.second, (-1) * p.first.first)]);
             i++) {
          ha *= 2;
          ha %= 1000000007;
        }
        for (int i = 0; i < (int)(s[p.first]); i++) {
          ma *= 2;
          ma %= 1000000007;
        }
        ans *= (ha + ma - 1);
        s.erase(make_pair(p.first.second, (-1) * p.first.first));
        s.erase(p.first);
      } else {
        for (int i = 0; i < (int)(s[p.first]); i++) {
          ans *= 2;
          ans %= 1000000007;
        }
        s.erase(p.first);
      }
    }
  }
  cout << ans + int64_t(check0) - 1 << endl;
}
