#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long a[n], b[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }
  long long count = 0;
  long long ans = 1;
  for (int i = 0; i < n - 1; i++) {
    for (long long j = 0; j < n; j++) {
      if (a[i] * a[j] + b[i] * b[j] == 0) count++;
    }
  }
  for (int i = 0; i < n; i++) {
    ans *= 2;
    ans %= 1000000007;
  }
  long long bb = 1;
  for (int i = 0; i < 1000000005; i++) {
    bb *= 4;
    bb %= 1000000007;
  }
  for (long long j = 0; j < count; j++) {
    ans *= 3;
    ans *= bb;
    ans %= 1000000007;
  }
  cout << ans - 1 << endl;
}
