#include <bits/stdc++.h>
using namespace std;
string ans_Yes = "Yes";
string ans_No = "No";
string ans_yes = "yes";
string ans_no = "no";
long long A[1000000];
long long B[1000000];
long long C;
long long N;
long long M;
long long K;
vector<int> root_size1;
vector<int> root_size2;
class UnionFind {
 public:
  vector<int> parent;
  UnionFind(int N) {
    for (int node_i = 0; node_i < N; node_i++) {
      int parent_i = node_i;
      parent.push_back(parent_i);
      root_size1.push_back(1);
      root_size2.push_back(0);
    }
  }
  int getRoot(int x) {
    if (parent[x] == x) return x;
    return parent[x] = getRoot(parent[x]);
  }
  void unite(int x, int y) {
    int rx = getRoot(x);
    int ry = getRoot(y);
    if (rx == ry) return;
    parent[rx] = ry;
    root_size1[ry] = root_size2[rx] + root_size1[ry];
    root_size2[ry] = root_size1[rx] + root_size2[ry];
    root_size1[rx] = root_size2[rx] + root_size1[ry];
    root_size2[rx] = root_size1[rx] + root_size2[ry];
  }
  bool isSameRoot(int x, int y) {
    int rx = getRoot(x);
    int ry = getRoot(y);
    return rx == ry;
  }
};
long long getPower(long long value, long long shisu, long long mod) {
  long long ans = 1;
  long long cnt = shisu;
  while (cnt > 0) {
    if (cnt % 2 == 1) {
      ans = ans * value % mod;
    }
    value = value * value % mod;
    cnt = cnt / 2;
  }
  return ans;
}
long long ans = 1;
int main() {
  cin >> N;
  for (int ni = 0; ni < (N); ni++) {
    cin >> A[ni];
    cin >> B[ni];
  }
  UnionFind uf(N);
  for (int ni = 0; ni <= N - 1 - 1; ni++) {
    for (int mi = ni + 1; mi <= N - 1; mi++) {
      if (A[ni] * A[mi] + B[ni] * B[mi] == 0) {
        uf.unite(ni, mi);
      }
    }
  }
  for (int ni = 0; ni < (N); ni++) {
    if (uf.getRoot(ni) == ni) {
      long long base = ans;
      ans = ans +
            base * (getPower(2, root_size1[ni], 1000000007) - 1) % 1000000007;
      if (root_size2[ni] > 0)
        ans = ans +
              base * (getPower(2, root_size2[ni], 1000000007) - 1) % 1000000007;
      ans = ans % 1000000007;
    }
  }
  cout << ans - 1 << endl;
}
