#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
long long gcd(long long a, long long b) {
  if (a % b == 0)
    return (b);
  else
    return (gcd(b, a % b));
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  map<pair<long long, long long>, int> rel;
  set<pair<long long, long long>> keys;
  int abz = 0, az = 0, bz = 0;
  for (int i = 0; i < (int)(n); i++) {
    long long a, b;
    cin >> a >> b;
    if (a == 0 && b == 0)
      abz++;
    else if (a == 0)
      az++;
    else if (b == 0)
      bz++;
    else {
      long long g = gcd(abs(a), abs(b));
      a /= g;
      b /= g;
      if (b < 0) {
        a *= -1;
        b *= -1;
      }
      keys.insert(make_pair(a, b));
      rel[make_pair(a, b)]++;
    }
  }
  vector<long long> pw(n + 1);
  pw[0] = 1;
  for (int i = 0; i < (int)(n); i++) pw[i + 1] = pw[i] * 2 % mod;
  long long ret = 1;
  for (auto itr = keys.begin(); itr != keys.end(); ++itr) {
    long long a = -(*itr).second, b = (*itr).first;
    if (b < 0) {
      a *= -1;
      b *= -1;
    }
    pair<long long, long long> op = make_pair(a, b);
    ret = ret * (((pw[rel[*itr]] + pw[rel[op]]) % mod) - 1) % mod;
    rel[*itr] = 0;
    rel[op] = 0;
  }
  ret = ret * (((pw[az] + pw[bz]) % mod) - 1) % mod;
  cout << (ret - 1 + abz) % mod << endl;
}
