#include <bits/stdc++.h>
using namespace std;
long long binpow(long long a, long long b, long long mod) {
  if (b == 0) {
    return 1ll;
  }
  long long temp = binpow(a, b / 2, mod);
  temp = (temp * temp) % mod;
  if (b % 2) {
    return (temp * a) % mod;
  }
  return temp;
}
long long gcd(long long a, long long b) {
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}
int main() {
  map<pair<long long, long long>, long long> cnt;
  long long n, a, b, zero = 0, temp;
  const long long mod = 1000000007;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    if (a == 0 && b == 0) {
      zero++;
    } else if (a == 0) {
      cnt[{1, 0}]++;
    } else if (b == 0) {
      cnt[{0, 1}]++;
    } else {
      temp = gcd(a, b);
      if (temp < 0) {
        temp *= -1;
      }
      a /= temp;
      b /= temp;
      if (b < 0) {
        b *= -1;
        a *= -1;
      }
      cnt[{a, b}]++;
    }
  }
  long long answ = 1ll;
  answ = ((answ + (binpow(2, cnt[{0, 1}], mod) + mod - 1)) % mod +
          (binpow(2, cnt[{1, 0}], mod) + mod - 1)) %
         mod;
  cnt[{0, 1}] = 0;
  cnt[{1, 0}] = 0;
  for (auto p : cnt) {
    long long last = answ;
    a = p.first.first;
    b = p.first.second;
    if (a < 0) {
      a *= -1;
      b *= -1;
    }
    if (p.second) {
      temp = binpow(2, p.second, mod) - 1;
      if (temp < 0) temp += mod;
      answ = (answ + (1ll * last * temp) % mod) % mod;
      if (cnt[{-b, a}]) {
        temp = binpow(2, cnt[{-b, a}], mod) - 1;
        if (temp < 0) temp += mod;
        answ = (answ + (1ll * last * temp) % mod) % mod;
      }
    }
    cnt[{-b, a}] = 0;
  }
  cout << answ + zero - 1 << '\n';
  return 0;
}
