#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int N;
  cin >> N;
  map<pair<long long int, long long int>, int> m;
  map<pair<long long int, long long int>, int> n;
  vector<pair<long long int, long long int> > ls;
  long long int A, B;
  for (int i = 0; i < N; i++) {
    cin >> A >> B;
    long long int g = gcd(A, B);
    m[make_pair(-B / g, A / g)]++;
    m[make_pair(B / g, -A / g)]++;
    n[make_pair(A / g, B / g)]++;
    n[make_pair(-A / g, -B / g)]++;
    ls.push_back(make_pair(A, B));
  }
  long long int ans = 0;
  long long int M = 1e9 + 7;
  long long int power[N + 1];
  power[0] = 1;
  for (int i = 1; i <= N; i++) power[i] = (power[i - 1] * 2) % M;
  for (int i = 0; i < N; i++) {
    A = ls[i].first;
    B = ls[i].second;
    int g = gcd(A, B);
    m[make_pair(-B / g, A / g)]--;
    m[make_pair(B / g, -A / g)]--;
    n[make_pair(A / g, B / g)]--;
    n[make_pair(-A / g, -B / g)]--;
    ans += power[N - 1 - i - m[make_pair(A / g, B / g)] -
                 n[make_pair(A / g, B / g)]];
    ans %= M;
  }
  cout << ans << "\n";
  return 0;
}
