#include <bits/stdc++.h>
using namespace std;
long long power(int a, int b, int c) {
  if (b == 0) return 1 % c;
  long long temp = power(a, b / 2, c) % c;
  if (b % 2 == 0) return (temp * temp) % c;
  return ((a * temp) % c * temp) % c;
}
int main() {
  int n;
  double a, b, t1, t2;
  scanf("%d", &n);
  map<double, pair<int, int> > m;
  for (int i = 0; i < n; ++i) {
    cin >> a >> b;
    double t1 = a / b, t2 = -b / a;
    if (m.find(t2) != m.end())
      ++m[t2].second;
    else if (m.find(t1) != m.end())
      ++m[t1].first;
    else
      m[t1] = make_pair(1, 0);
  }
  long long ans = 1;
  for (const auto &p : m) {
    long long tmp = power(2, (p.second).first, 1000000007) +
                    power(2, (p.second).second, 1000000007) - 1;
    ans = (ans * (tmp % 1000000007)) % 1000000007;
  }
  cout << ans - 1;
}
