#include <bits/stdc++.h>
using namespace std;
long long powM(long long a, long long b, long long m) {
  a %= m;
  long long ans = 1;
  while (b > 0) {
    if (b & 1) ans = ans * a % m;
    a = a * a % m;
    b >>= 1;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long p = 1e9 + 7;
  double n, a, b;
  cin >> n;
  map<double, long long> m, t;
  for (int i = 1; i <= n; i++) {
    cin >> a >> b;
    double x1 = a / b;
    double x2 = -b / a;
    m[x1]++;
    t[x2]++;
  }
  long long del = 0;
  long long ans = powM(2, n, p) - 1;
  for (auto x : m) {
    long long cnt1 = x.second;
    long long cnt2 = t[x.first];
    long long temp = (powM(2, cnt1, p) - 1) * (powM(2, cnt2, p) - 1) % p;
    temp = temp * (powM(2, n - cnt1 - cnt2, p)) % p;
    del = del + temp;
  }
  del /= 2;
  long long final = (ans + p - del) % p;
  cout << final << "\n";
  return 0;
}
