#include <bits/stdc++.h>
using namespace std;
long long int INF = 3e18;
const long long fact_table = 1200008;
double Pi = 3.1415926535897932384626;
priority_queue<long long> pql;
priority_queue<pair<long long, long long> > pqp;
priority_queue<pair<long long, long long> > bag;
priority_queue<long long, vector<long long>, greater<long long> > pqls;
priority_queue<pair<long long, long long>, vector<pair<long long, long long> >,
               greater<pair<long long, long long> > >
    pqps;
long long dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
long long dy[8] = {0, 1, 0, -1, 1, -1, -1, 1};
char dir[] = "DRUL";
const long long mod = 1000000007ll;
const long long mod2 = 2000000011ll;
long long mypow(long long number1, long long number2, long long mod) {
  if (number2 == 0) {
    return 1ll;
  } else {
    long long number3 = mypow(number1, number2 / 2, mod);
    number3 *= number3;
    number3 %= mod;
    if (number2 % 2 == 1) {
      number3 *= number1;
      number3 %= mod;
    }
    return number3;
  }
}
void YES(bool condition) {
  if (condition) {
    cout << "YES"
         << "\n";
    ;
  } else {
    cout << "NO"
         << "\n";
    ;
  }
  return;
}
void Yes(bool condition) {
  if (condition) {
    cout << "Yes"
         << "\n";
    ;
  } else {
    cout << "No"
         << "\n";
    ;
  }
  return;
}
bool multicase = false;
long long n, m, num, a, b, c, d, e, q, ans;
long long x[500005], y[500005], z[500005];
;
long long cost[500005];
vector<long long> G[500005];
queue<long long> que;
long long zero_num, inf_num;
void solve() {
  map<long long, long long> table1, table2;
  cin >> n;
  long long ans = 1;
  long long tmp = 0ll;
  for (long long i = 0; i < n; i++) {
    cin >> x[i] >> y[i];
    if (x[i] == 0 && y[i] == 0) {
      tmp++;
      continue;
    }
    bool minus = false;
    if (x[i] > 0 && y[i] < 0) {
      minus = true;
      y[i] = -y[i];
    } else if (x[i] < 0 && y[i] > 0) {
      minus = true;
      x[i] = -x[i];
    }
    long long a;
    bool zero = false;
    if (x[i] == 0) {
      zero = true;
      a = mod2 + 1;
    } else if (y[i] == 0) {
      zero = true;
      a = 0;
    } else {
      x[i] %= mod2, y[i] %= mod2;
      a = (y[i] * mypow(x[i], mod2 - 2, mod2)) % mod2;
    }
    if (zero) {
      if (a == 0) {
        zero_num++;
      } else {
        inf_num++;
      }
    } else if (minus) {
      table2[a]++;
    } else {
      table1[a]++;
    }
  }
  ans *= (mypow(2ll, zero_num, mod) + mypow(2ll, inf_num, mod) - 1);
  ans %= mod;
  for (auto v : table1) {
    long long value = v.first, size1 = v.second;
    long long nvalue = mypow(value, mod2 - 2, mod2);
    long long size2 = table2[nvalue];
    long long res = mypow(2ll, size1, mod) + mypow(2ll, size2, mod);
    res %= mod;
    res = res + mod - 1;
    res %= mod;
    ans *= res;
    ans %= mod;
  }
  for (auto v : table2) {
    long long value = v.first, size1 = v.second;
    long long nvalue = mypow(value, mod2 - 2, mod2);
    long long size2 = table1[nvalue];
    if (size2 >= 1) continue;
    long long res = mypow(2ll, size1, mod);
    ans *= res;
    ans %= mod;
  }
  ans = ans + mod - 1;
  ans %= mod;
  ans = ans + tmp;
  ans %= mod;
  cout << ans << "\n";
  ;
  return;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  long long q, testcase = 1;
  if (multicase) {
    cin >> q;
  } else {
    q = 1;
  }
  while (q--) {
    solve();
    testcase++;
  }
  return 0;
}
