#include <bits/stdc++.h>
using namespace std;
const long long INF = 100100100100100100;
const long long MOD = 1000000007;
long long my_abs(long long a);
long long a_n(long long a, long long n);
long long my_gcd(long long a, long long b);
long long inv(long long a);
long long madd(long long a, long long b, long long c);
long long msub(long long a, long long b);
long long mtime(long long a, long long b, long long c);
int main() {
  long long n, ans = 0, zeros = 0;
  vector<long long> pairs;
  cin >> n;
  map<pair<long long, long long>, long long> m;
  for (long long(i) = 0; (i) < (long long)(n); (i)++) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) {
      zeros++;
    } else if (a == 0) {
      b = 1;
      pair<long long, long long> tmp = make_pair(a, b);
      if (m.count(tmp))
        m[tmp]++;
      else
        m[tmp] = 1;
    } else if (b == 0) {
      a = 1;
      pair<long long, long long> tmp = make_pair(a, b);
      if (m.count(tmp))
        m[tmp]++;
      else
        m[tmp] = 1;
    } else {
      if (a < 0) {
        a *= -1;
        b *= -1;
      }
      long long plus = my_abs(b);
      long long div = my_gcd(a, plus);
      a /= div;
      b /= div;
      pair<long long, long long> tmp = make_pair(a, b);
      if (m.count(tmp))
        m[tmp]++;
      else
        m[tmp] = 1;
    }
  }
  set<pair<long long, long long> > se;
  for (auto p : m) {
    auto key = p.first;
    auto value = p.second;
    if (se.count(key)) continue;
    long long tmp;
    pair<long long, long long> bad;
    if (key.first == 0) {
      bad = make_pair(1, 0);
      if (m.count(bad)) {
        tmp = a_n(2, value) + a_n(2, m[bad]) - 1;
        tmp %= MOD;
        pairs.push_back(tmp);
      } else {
        tmp = a_n(2, value);
        tmp %= MOD;
        pairs.push_back(tmp);
      }
    } else if (key.second == 0) {
      bad = make_pair(0, 1);
      if (m.count(bad)) {
        tmp = a_n(2, value) + a_n(2, m[bad]) - 1;
        tmp %= MOD;
        pairs.push_back(tmp);
      } else {
        tmp = a_n(2, value);
        tmp %= MOD;
        pairs.push_back(tmp);
      }
    } else {
      if (key.second < 0) {
        bad = make_pair(-1 * key.second, key.first);
      } else {
        bad = make_pair(key.second, -1 * key.first);
      }
      if (m.count(bad)) {
        tmp = a_n(2, value) + a_n(2, m[bad]) - 1;
        tmp %= MOD;
        pairs.push_back(tmp);
      } else {
        tmp = a_n(2, value);
        tmp %= MOD;
        pairs.push_back(tmp);
      }
    }
    se.insert(bad);
    se.insert(key);
  }
  ans = 1;
  for (long long(i) = 0; (i) < (long long)(pairs.size()); (i)++) {
    ans *= pairs[i];
    ans %= MOD;
  }
  cout << (ans - 1 + zeros) % MOD << endl;
  return 0;
}
long long my_abs(long long a) {
  if (a >= 0)
    return a;
  else
    return -1 * a;
}
long long a_n(long long a, long long n) {
  if (n == 0) return 1;
  long long ret = a, count = 1;
  while (count * 2 < n) {
    ret *= ret;
    ret %= MOD;
    count *= 2;
  }
  if (count == n)
    return ret;
  else
    return (ret * a_n(a, n - count)) % MOD;
}
long long my_gcd(long long a, long long b) {
  if (b == 0) return a;
  return my_gcd(b, a % b);
}
long long inv(long long a) { return a_n(a, MOD - 2); }
long long madd(long long a, long long b, long long c) {
  long long ret = (a + b) % MOD;
  return (ret + c) % MOD;
}
long long msub(long long a, long long b) {
  if (a < b)
    return (a - b + MOD) % MOD;
  else
    return (a - b) % MOD;
}
long long mtime(long long a, long long b, long long c) {
  long long ret = (a * b) % MOD;
  return (ret * c) % MOD;
}
