#include <bits/stdc++.h>
using namespace std;
long long module = 1000000007;
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long power2(long long n) {
  long long res = 1;
  long long a = 2;
  while (n > 0) {
    if (n & 1) {
      res = res * a % module;
    }
    a = a * a % module;
    n >>= 1;
  }
  return res;
}
signed main() {
  long long n;
  cin >> n;
  map<pair<bool, pair<long long, long long>>, long long> vals;
  long long zeroPair = 0;
  for (int i = 0; i < n; i++) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      zeroPair++;
      continue;
    }
    long long div = gcd(abs(a), abs(b));
    a /= div;
    b /= div;
    long long coR = (a > 0 ? 1 : -1) * (b > 0 ? 1 : -1);
    vals[make_pair((coR > 0), make_pair(abs(a), abs(b)))]++;
  }
  long long pairs = 1;
  for (const auto& [key, count] : vals) {
    if (count == -1) continue;
    auto pair =
        make_pair(!(key.first), make_pair(key.second.second, key.second.first));
    long long badCount = vals[pair];
    if (badCount == -1) continue;
    long long currPair = (power2(count) - 1 + power2(badCount) - 1 + 1);
    pairs *= currPair;
    pairs = pairs % module;
    vals[pair] = -1;
    vals[key] = -1;
  }
  long long allPair = (long long)(pairs + zeroPair - 1) % module;
  cout << allPair << endl;
}
