#include <bits/stdc++.h>
using namespace std;
long long n, cnt00 = 0, cnta0 = 0, cntb0 = 0;
double a, b;
const long long p = 1000000007;
void ins(map<double, pair<long long, long long>>& m, double a, double b) {
  double k1 = floor(a / b * 1e18);
  double k2 = floor(-b / a * 1e18);
  if (m.count(k1) == 0) {
    if (m.count(k2) == 0) {
      if (abs(a / b) > 1) {
        m[k1].first = 1;
        m[k1].second = 0;
      } else {
        m[k2].first = 0;
        m[k2].second = 1;
      }
    } else
      m[k2].second++;
  } else
    m[k1].first++;
}
long long pow2(long long k) {
  long long c = 2;
  long long f = 1;
  for (long long bit = 1; bit <= k; bit <<= 1) {
    if (k & bit) f = f * c % p;
    c = c * c % p;
  }
  return f;
}
int main() {
  cin >> n;
  map<double, pair<long long, long long>> line_map;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    if (b == 0) {
      if (a == 0)
        cnt00++;
      else
        cntb0++;
    } else if (a == 0) {
      cnta0++;
    } else
      ins(line_map, a, b);
  }
  long long ans = 1;
  for (auto i = line_map.begin(); i != line_map.end(); ++i) {
    long long& cnt1 = i->second.first;
    long long& cnt2 = i->second.second;
    ans = (ans * (pow2(cnt1) + pow2(cnt2) - 1) + p) % p;
  }
  ans = (ans * (pow2(cnta0) + pow2(cntb0) - 1) - 1 + cnt00 + p) % p;
  cout << ans;
}
