#include <bits/stdc++.h>
using namespace std;
long long N;
map<pair<long long, long long>, pair<long long, long long> > memo;
long gcd(long a, long b) {
  if (a % b == 0) {
    return (b);
  } else {
    return (gcd(b, a % b));
  }
}
long lcm(long m, long n) {
  if ((0 == m) || (0 == n)) return 0;
  return ((m / gcd(m, n)) * n);
}
long long modpow(long long ori, long long po) {
  long long res = 1;
  while (po > 0) {
    if (po & 1) {
      res *= ori;
      res %= 1000000007;
    }
    ori *= ori;
    ori %= 1000000007;
    po >>= 1;
  }
  return res;
}
int main() {
  cin >> N;
  long long ans = 1;
  for (long long i = 0; i < N; i++) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      ans++;
      continue;
    }
    if (a == 0) {
      memo[make_pair(0, 0)].first++;
      ;
      continue;
    }
    if (b == 0) {
      memo[make_pair(0, 0)].second++;
      ;
      continue;
    }
    long long divi = gcd(a, b);
    a /= divi;
    b /= divi;
    if (a > 0 && b > 0) {
      memo[make_pair(a, b)].first++;
      ;
      continue;
    }
    if (a < 0 && b < 0) {
      memo[make_pair(-1 * a, -1 * b)].first++;
      ;
      continue;
    }
    memo[make_pair(abs(b), abs(a))].second++;
    ;
  }
  for (const auto& [key, value] : memo) {
    ans *= (modpow(2, value.first) + modpow(2, value.second) - 1);
    ans %= 1000000007;
  }
  cout << (ans - 1 + 1000000007) % 1000000007 << endl;
}
