#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);
}
int main(int, char**) {
  int n;
  cin >> n;
  map<pair<long long, long long>, int> mp;
  for (int i = 0; i < (n); i++) {
    long long a, b;
    cin >> a >> b;
    if (!a) {
      if (b) b = 1;
    } else if (!b) {
      a = 1;
    } else {
      long long d = gcd(abs(a), abs(b));
      if (b < 0) d *= -1;
      a /= d;
      b /= d;
    }
    mp[pair<long long, long long>(a, b)]++;
  }
  vector<long long> pow2(n + 1);
  pow2[0] = 1;
  for (int i = 0; i < (n + 1); i++) {
    if (!i)
      pow2[i] = 1;
    else {
      pow2[i] = (pow2[i - 1] << 1) % 1000000007;
    }
  }
  long long ans = 1;
  for (auto m : mp) {
    long long a = m.first.first;
    long long b = m.first.second;
    int v = m.second;
    if (a == 0 && b == 0) continue;
    long long a2, b2;
    if (a > 0) {
      a2 = -b;
      b2 = a;
    } else {
      a2 = b;
      b2 = -a;
    }
    int v2 = mp[pair<long long, long long>(a2, b2)];
    ans *= (pow2[v] + pow2[v2] - 1) % 1000000007;
    ans %= 1000000007;
    mp[pair<long long, long long>(a, b)] =
        mp[pair<long long, long long>(a2, b2)] = 0;
  }
  ans += mp[pair<long long, long long>(0, 0)];
  ans %= 1000000007;
  ans--;
  cout << ans << endl;
  return 0;
}
