#include <bits/stdc++.h>
using namespace std;
const int M = 1000000007;
long long n, sz00, sz01, sz10, a, b, g, res, sz, sz2;
map<pair<long long, long long>, pair<long long, long long> > m;
map<pair<long long, long long>, pair<long long, long long> >::iterator it;
long long sm(long long a, long long b) {
  a %= M;
  b %= M;
  return (a + b) % M;
}
long long prdct(long long a, long long b) {
  a %= M;
  b %= M;
  return (a * b) % M;
}
long long pw(long long b, long long p) {
  if (p == 0) return 1;
  long long ret;
  ret = pw(b, p / 2);
  ret = prdct(ret, ret);
  if (p % 2 == 1) ret = prdct(ret, b);
  return ret;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long absLL(long long a) {
  if (a < 0) a *= -1;
  return a;
}
int sgn(long long a) {
  if (a < 0) return -1;
  return 1;
}
void solve() {
  cin >> n;
  sz00 = 0;
  sz01 = 0;
  sz10 = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a >> b;
    if (a == 0 && b == 0) {
      sz00++;
    } else if (a == 0) {
      sz01++;
    } else if (b == 0) {
      sz10++;
    } else {
      g = gcd(absLL(a), absLL(b));
      a /= g;
      b /= g;
      if (sgn(a) == sgn(b)) {
        m[make_pair(absLL(a), absLL(b))].first++;
      } else {
        m[make_pair(absLL(b), absLL(a))].second++;
      }
    }
  }
  res = sm(sm(pw(2, sz01), pw(2, sz10)), M - 1);
  for (it = m.begin(); it != m.end(); it++) {
    sz = (it->second).first;
    sz2 = (it->second).second;
    res = prdct(res, sm(sm(pw(2, sz), pw(2, sz2)), M - 1));
  }
  res = sm(res, sm(pw(2, sz00), M - 1));
  res = sm(res, M - 1);
  cout << res << "\n";
}
int main() {
  std::ios::sync_with_stdio(0);
  cin.tie(0);
  solve();
  return 0;
}
