#include <bits/stdc++.h>
using namespace std;
long long n, a, b, m = 1;
long long w[200000];
const long long M = 1e9 + 7;
map<pair<long long, long long>, pair<long long, long long> > Mp;
int main() {
  cin >> n;
  w[0] = 1;
  for (int i = 1; i <= n; i++) w[i] = w[i - 1] * 2 % M;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    bool f = 0;
    for (auto itr = Mp.begin(); itr != Mp.end(); itr++) {
      if (a * itr->first.second == b * itr->first.first) {
        f = 1;
        itr->second.first++;
        break;
      } else if (a * itr->first.first + b * itr->first.second == 0) {
        f = 1;
        itr->second.second++;
        break;
      }
    }
    if (!f) Mp[make_pair(a, b)] = make_pair(1, 0);
  }
  for (auto itr = Mp.begin(); itr != Mp.end(); itr++) {
    long long x = itr->second.first, y = itr->second.second;
    m = m * (w[x] + w[y] - 1) % M;
  }
  cout << m - 1 << endl;
}
