#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  long long tmp = a % b;
  if (tmp == 0) return b;
  return gcd(b, tmp);
}
long long pow(long long a, long long n) {
  if (n == 0) return 1;
  if (n == 1) return a % 1000000007;
  long long tmp = pow(a, n / 2);
  tmp %= 1000000007;
  long long tmp2 = tmp * tmp;
  tmp2 %= 1000000007;
  if (n % 2 == 1) return (tmp2 * a) % 1000000007;
  return tmp2;
}
int main() {
  int N;
  int orgn = 0;
  map<pair<long long, long long>, pair<long long, long long> > mp;
  cin >> N;
  for (int i = 0; i < N; i++) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      orgn++;
      continue;
    }
    if (a == 0) {
      mp[{0, 1}].first++;
      continue;
    }
    if (b == 0) {
      mp[{0, 1}].second++;
      continue;
    }
    long long g = gcd(abs(a), abs(b));
    if (b > 0) {
      a /= g;
      b /= g;
    } else {
      a /= (-g);
      b /= (-g);
    }
    if (a > 0) {
      mp[{a, b}].first++;
    } else {
      mp[{b, abs(a)}].second++;
    }
  }
  long long ans = 1;
  for (auto p : mp) {
    ans *= pow(2, p.second.first) + pow(2, p.second.second) - 1 + 1000000007;
    ans %= 1000000007;
  }
  ans += orgn + 1000000007 - 1;
  ans %= 1000000007;
  cout << ans << endl;
  return 0;
}
