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