#include <bits/stdc++.h>
using namespace std;
long long gcd(long long x, long long y) {
  if (x % y == 0) {
    return (y);
  } else {
    return (gcd(y, x % y));
  }
}
long long lcm(long long x, long long y) { return x / gcd(x, y) * y; }
long long mod_pow(long long x, long long n, const long long p) {
  long long ret = 1ll;
  while (n > 0) {
    if (n & 1) (ret *= x) %= p;
    (x *= x) %= p;
    n >>= 1;
  }
  return ret;
}
int main() {
  long long N;
  cin >> N;
  map<pair<long long, long long>, pair<long long, long long> > score;
  long long ABo = 0ll;
  long long Ao = 0ll;
  long long Bo = 0ll;
  long long ans = 0ll;
  for (long long i = 0; i < (long long)(N); i++) {
    long long a, b;
    int flag = 0;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      ABo++;
      continue;
    }
    if (a == 0) {
      Ao++;
      continue;
    }
    if (b == 0) {
      Bo++;
      continue;
    }
    if (a > 0ll && b < 0ll) {
      flag = 1;
    }
    if (a < 0ll && b > 0ll) {
      flag = 1;
    }
    if (a < 0ll) {
      a = -a;
    }
    if (b < 0ll) {
      b = -b;
    }
    long long g = gcd(a, b);
    a /= g;
    b /= g;
    if (flag == 0) {
      score[pair<long long, long long>(a, b)].second++;
    }
    if (flag == 1) {
      score[pair<long long, long long>(b, a)].first++;
    }
  }
  ans = 1ll;
  ans = mod_pow(2ll, Ao, (long long)1000000007) +
        mod_pow(2ll, Bo, (long long)1000000007) - 1ll;
  ans %= (long long)1000000007;
  for (auto k : score) {
    auto p = k.second.first;
    auto q = k.second.second;
    p = mod_pow(2ll, p, (long long)1000000007);
    q = mod_pow(2ll, q, (long long)1000000007);
    ans = ans * ((p + q - 1ll) % (long long)1000000007);
    ans %= (long long)1000000007;
  }
  ans += ABo;
  ans--;
  ans %= (long long)1000000007;
  cout << ans;
}
