#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 50;
long long pw[N];
long long mod = 1e9 + 7;
long long a[N];
long long b[N];
long long gcd(long long a, long long b) {
  while (b) {
    a %= b, swap(a, b);
  }
  return a;
}
map<pair<long long, long long>, pair<long long, long long>> s;
int main() {
  cin.sync_with_stdio(0);
  pw[0] = 1;
  for (int i = 1; i < N; ++i) pw[i] = (pw[i - 1] * 2) % mod;
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i] >> b[i];
  }
  for (int i = 0; i < n; ++i) {
    if (!a[i] && !b[i]) continue;
    long long f = gcd(llabs(a[i]), llabs(b[i]));
    a[i] /= f;
    b[i] /= f;
    if (a[i] < 0) a[i] *= -1, b[i] *= -1;
    if (b[i] < 0)
      s[{-b[i], a[i]}].second++;
    else
      s[{a[i], b[i]}].first++;
  }
  long long mul = 1;
  for (auto i : s) {
    long long d =
        ((pw[i.second.first] + pw[i.second.second]) % mod - 1 + mod) % mod;
    mul = (mul * d) % mod;
  }
  cout << (mul - 1 + mod) % mod;
  return 0;
}
