#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const long double Pi = acos(-1);
int gcd(long long x, long long y) {
  if (x % y == 0) {
    return y;
  } else {
    gcd(y, x % y);
  }
}
int nature(long long z) {
  if (z >= 0) {
    return z;
  } else {
    return -1 * z;
  }
}
long long mod_pow(long long a, long long b) {
  if (b == 0) {
    return 1;
  }
  long long res = mod_pow(a * a % MOD, b / 2);
  if (b & 1) res = res * a % MOD;
  return res;
}
int main() {
  long long N, count0 = 0, countx0 = 0, county0 = 0, answer = 0;
  cin >> N;
  vector<long long> vec(N);
  vector<long long> first(N);
  vector<long long> second(N);
  vector<vector<long long>> plus(N, vector<long long>(N));
  vector<vector<long long>> mainasu(N, vector<long long>(N));
  for (long long i = 0; i < N; i++) {
    long long a, b;
    cin >> a >> b;
    a %= MOD;
    b %= MOD;
    long long c = a, d = b;
    if (a == 0 && b == 0) {
      ++count0;
      first.at(i) = 0;
      second.at(i) = 0;
    }
    if (a == 0 && b != 0) {
      ++countx0;
      first.at(i) = 0;
      second.at(i) = b;
    }
    if (a != 0 && b == 0) {
      ++county0;
      first.at(i) = a;
      second.at(i) = 0;
    } else {
      a /= gcd((long long)nature(c), (long long)nature(d));
      b /= gcd((long long)nature(c), (long long)nature(d));
      if (c * d > 0) {
        a = nature(a);
        b = nature(b);
      } else {
        a = -1 * nature(a);
        b = nature(b);
      }
    }
    first.at(i) = a;
    second.at(i) = b;
    if (a >= 1) {
      plus.at(a - 1).at(b - 1)++;
    }
    if (a < 0) {
      mainasu.at(nature(a + 1)).at(b - 1)++;
    }
  }
  for (long long i = 0; i < N; i++) {
    if (first.at(i) > 0) {
      if (mainasu.at(second.at(i) - 1).at(first.at(i) - 1) > 0) {
        answer += mainasu.at(second.at(i) - 1).at(first.at(i) - 1) *
                  (mainasu.at(second.at(i) - 1).at(first.at(i) - 1) + 1) / 2;
      }
    }
    if (first.at(i) < 0) {
      if (plus.at(second.at(i) - 1).at(-1 * first.at(i) - 1) > 0) {
        answer += plus.at(second.at(i) - 1).at(-1 * first.at(i) - 1) *
                  (plus.at(second.at(i) - 1).at(-1 * first.at(i) - 1) + 1) / 2;
      }
    }
  }
  long long ans = answer / 2 + count0 * (count0 - 1) / 2 +
                  countx0 * (county0 + count0) + county0 * (countx0 + count0);
  cout << mod_pow(2, N) - 1 - mod_pow(2, ans) << endl;
}
