#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int gcd(int x, int y) {
  if (y == 0) {
    return x;
  } else {
    return gcd(y, x % y);
  }
};
unsigned int modpow(const unsigned int n, unsigned int r) {
  if (r == 0) {
    return 1;
  }
  unsigned long long rtn = modpow(n, r / 2);
  rtn *= rtn;
  rtn %= MOD;
  if (r % 2 == 1) {
    rtn *= n;
  }
  return rtn % MOD;
};
int main() {
  map<pair<int, int>, int> cnt;
  long long ans = 1;
  int n;
  assert(0 < scanf("%d", &n));
  for (decltype(n) _i = 0, _n = (n); _i < _n; _i++) {
    int a;
    assert(0 < scanf("%d", &a));
    int b;
    assert(0 < scanf("%d", &b));
    int d = 1;
    if (a == 0 || b == 0) {
      if (a == 0 && b != 0) {
        b = 1;
      } else if (a != 0 && b == 0) {
        a = 1;
      }
    } else if ((0 < a) == (0 < b)) {
      if (a < 0) {
        a *= -1;
        b *= -1;
      }
      d = gcd(a, b);
    } else {
      if (a < 0) {
        a *= -1;
        b *= -1;
      }
      d = gcd(a, -b);
    }
    pair<int, int> p = make_pair(a / d, b / d);
    if (cnt.count(p)) {
      cnt[p]++;
    } else {
      cnt[p] = 1;
    }
  }
  for (auto&& it = begin(cnt); it != end(cnt); it++) {
    pair<int, int> p = it->first;
    int a = p.first, b = p.second, x = it->second, y;
    long long tmp = 1;
    if (a == 0 && b == 0) {
      tmp = 1;
    } else if (a == 0 && b != 0) {
      if (cnt.count(make_pair(1, 0))) {
        y = cnt[make_pair(1, 0)];
        tmp = modpow(2, x) + modpow(2, y) - 1;
      } else {
        tmp = modpow(2, x);
      }
    } else if (b == 0 && a != 0) {
      if (cnt.count(make_pair(0, 1))) {
        tmp = 1;
      } else {
        tmp = modpow(2, x);
      }
    } else if (0 < b) {
      if (cnt.count(make_pair(b, -a))) {
        y = cnt[make_pair(b, -a)];
        tmp = modpow(2, x) + modpow(2, y) - 1;
      } else {
        tmp = modpow(2, x);
      }
    } else {
      if (cnt.count(make_pair(-b, a))) {
        tmp = 1;
      } else {
        tmp = modpow(2, x);
      }
    }
    tmp %= MOD;
    ans *= tmp;
    ans %= MOD;
  }
  if (cnt.count(make_pair(0, 0))) {
    ans += cnt[make_pair(0, 0)];
    ans %= MOD;
  }
  ans = (ans - 1) % MOD;
  printf("%lld\n", ans);
  return 0;
}
