#include <bits/stdc++.h>
using namespace std;
const double pi = 3.141592653589793238;
long long INF = 1e9 + 7;
long long two[100006];
void calc() {
  two[0] = 1;
  for (int i = 1; i < 100005; i++) {
    two[i] = (2 * two[i - 1]) % INF;
  }
}
int main() {
  long long n;
  cin >> n;
  calc();
  vector<vector<long long>> arr(n, vector<long long>(2, 0));
  for (int i = 0; i < n; i++) cin >> arr[i][0] >> arr[i][1];
  unordered_map<double, int> hmap;
  int a_zeros = 0;
  int b_zeros = 0;
  int all_zeros = 0;
  long long ans = 0;
  long long prev = 0;
  for (int i = 0; i < n; i++) {
    if (arr[i][0] == 0 && arr[i][1] == 0) {
      all_zeros++;
      ans = (ans + 1) % INF;
    } else if (arr[i][0] == 0) {
      a_zeros++;
      ans = (ans + two[i - all_zeros - b_zeros]) % INF;
    } else if (arr[i][1] == 0) {
      b_zeros++;
      ans = (ans + two[i - all_zeros - a_zeros]) % INF;
    } else {
      int num = hmap[-((double)(arr[i][1]) / (arr[i][0]))];
      hmap[((double)(arr[i][0])) / (arr[i][1])]++;
      ans = (ans + two[i - all_zeros - num]) % INF;
    }
    prev = ans;
  }
  cout << ans << endl;
  return 0;
}
