#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  a = abs(a), b = abs(b);
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long mod(long long a, long long b, long long m) {
  if (b == 0) return 1;
  if (b == 1) return a % m;
  if (b & 1)
    return a * mod(a, b - 1, m) % m;
  else {
    long long t = mod(a, b / 2, m);
    return t * t % m;
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  int z = 0;
  map<pair<long long, long long>, pair<long long, long long> > m;
  for (int i = 0; i < n; ++i) {
    long long a, b;
    cin >> a >> b;
    if (!a && !b) {
      z++;
      continue;
    }
    long long g = gcd(a, b);
    a /= g;
    b /= g;
    if (b < 0) a = -a, b = -b;
    if (b == 0 && a < 0) a = -a;
    if (a > 0)
      m[pair<long long, long long>(a, b)].first++;
    else
      m[pair<long long, long long>(b, -a)].second++;
  }
  long long md = 1e9 + 7, ans = 1;
  for (auto a : m)
    ans *= (mod(2, a.second.first, md) + mod(2, a.second.second, md) - 1) % md;
  cout << (ans + z - 1 + md) % md << '\n';
}
