#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a < b) return gcd(b, a);
  long long r;
  while ((r = a % b)) {
    a = b;
    b = r;
  }
  if (b > 0)
    return b;
  else
    return -b;
}
long long myPow(long long x, long long n, long long m) {
  if (n == 0) return 1;
  if (n % 2 == 0)
    return myPow(x * x % m, n / 2, m);
  else
    return x * myPow(x, n - 1, m) % m;
}
int main() {
  int N;
  cin >> N;
  vector<pair<long, long> > AB(N);
  map<pair<long, long>, long long> eigen;
  for (int i = 0; i < N; i++) {
    cin >> AB.at(i).first >> AB.at(i).second;
    if (AB.at(i).first < 0) {
      AB.at(i).first *= -1;
      AB.at(i).second *= -1;
    }
    long long tmp = gcd(AB.at(i).first, AB.at(i).second);
    if (eigen.count(make_pair(AB.at(i).first / tmp, AB.at(i).second / tmp)))
      eigen.at(make_pair(AB.at(i).first / tmp, AB.at(i).second / tmp))++;
    else
      eigen[make_pair(AB.at(i).first / tmp, AB.at(i).second / tmp)] = 1;
  }
  long long ans = myPow(2, N, 1000000007) - 1;
  vector<pair<int, int> > counted_pair;
  for (auto x : eigen) {
    long long tmpx = x.first.second, tmpy = -1 * x.first.first;
    if (tmpx < 0) {
      tmpx *= -1;
      tmpy *= -1;
    }
    if (tmpx >= x.first.first && eigen.count(make_pair(tmpx, tmpy))) {
      if (tmpx != x.first.first || tmpy >= x.first.second) {
        long long tmp_minus =
            myPow(2, x.second, 1000000007) *
            myPow(2, eigen.at(make_pair(tmpx, tmpy)), 1000000007);
        tmp_minus %= 1000000007;
        tmp_minus -= myPow(2, x.second, 1000000007) +
                     myPow(2, eigen.at(make_pair(tmpx, tmpy)), 1000000007) - 1;
        if (!counted_pair.size())
          tmp_minus *= myPow(2, N - x.second - eigen.at(make_pair(tmpx, tmpy)),
                             1000000007);
        else {
          int tmpN = N - x.second - eigen.at(make_pair(tmpx, tmpy));
          for (int i = 0; i < counted_pair.size(); i++)
            tmpN -= counted_pair.at(i).first + counted_pair.at(i).second;
          long long tmp_tmp = myPow(2, tmpN, 1000000007);
          long long tmp_sum = 0;
          for (int i = 0; i < counted_pair.size(); i++) {
            tmp_sum += (myPow(2, counted_pair.at(i).first, 1000000007) +
                        myPow(2, counted_pair.at(i).second, 1000000007)) -
                       1;
            tmp_sum %= 1000000007;
          }
          tmp_tmp *= tmp_sum;
          tmp_tmp %= 1000000007;
          tmp_minus *= tmp_tmp;
        }
        tmp_minus %= 1000000007;
        ans -= tmp_minus;
        while (ans < 0) ans += 1000000007;
        ans %= 1000000007;
        counted_pair.push_back(
            make_pair(x.second, eigen.at(make_pair(tmpx, tmpy))));
      }
    }
  }
  cout << ans << endl;
}
