#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long power(long long first, unsigned long long second,
                unsigned long long m) {
  if (second == 0) return 1;
  long long p = power(first, second / 2, m) % m;
  p = (p * p) % m;
  return (second % 2 == 0) ? p : (first * p) % m;
}
long long modInverse(long long a, long long m) {
  { return power(a, m - 2, m); }
}
const long long maxn = 500003;
void solve() {
  long long n;
  cin >> n;
  map<pair<long long, long long>, long long> m;
  long long a, b;
  long long cntt = 0;
  long long pow2[200005] = {0};
  pow2[0] = 1;
  for (long long i = 1; i < 200005; i++) {
    (pow2[i] = pow2[i - 1] * (2)) %= 1000000007;
  }
  for (long long i = 0; i < n; i++) {
    cin >> a >> b;
    if (!a && !b) {
      cntt++;
      continue;
    }
    if (a < 0) a *= -1, b *= -1;
    long long g = abs(gcd(a, b));
    m[make_pair(a / g, b / g)]++;
  }
  long long ans = 1;
  for (auto it : m) {
    if (it.second == 0) continue;
    long long l = it.first.first;
    long long r = it.first.second;
    long long cnt = it.second;
    long long p1 = -r;
    long long p2 = l;
    m[make_pair(it.first.first, it.first.second)] = 0;
    if (p1 < 0) p1 *= -1, p2 *= -1;
    long long cnt2 = m[make_pair(p1, p2)];
    m[make_pair(p1, p2)] = 0;
    (ans *= (pow2[cnt] - 1 + pow2[cnt2] - 1 + 1 + 1000000007)) %= 1000000007;
  }
  cout << (ans - 1 + cntt + 1000000007) % 1000000007 << "\n";
}
signed main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
  return 0;
}
