#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
const long long LL_INF = 0x3f3f3f3f3f3f3f3f;
template <typename T>
T gcd(T a, T b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long power(long long a, long long b, long long m = 1000000007) {
  long long answer = 1;
  while (b) {
    if (b & 1) answer = (answer * a) % m;
    b /= 2;
    a = (a * a) % m;
  }
  return answer;
}
using namespace std;
void ctrl() { cout << "Control" << endl; }
long long make_num(string p) {
  stringstream geek(p);
  long long x = 0;
  geek >> x;
  return x;
}
string make_str(long long x) {
  ostringstream str1;
  str1 << x;
  string geek = str1.str();
  return geek;
}
const long long N = 1e5 + 5;
vector<long long> v[N];
long long dist[N], par[N];
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin.exceptions(cin.failbit);
  string p;
  long long n, m;
  cin >> n;
  unordered_map<long double, long long> mp;
  long long second = 1;
  long long ght = 0, you = 0;
  long long snd = 0, fst = 0;
  for (long long i = 0; i < n; i++) {
    long long x, y;
    cin >> x >> y;
    if (y == 0 && x) {
      snd++;
      continue;
    } else if (x == 0 && y) {
      fst++;
      continue;
    } else if (x == 0 && y == 0) {
      you++;
      continue;
    }
    long double yt = (x * 1.0) / y;
    mp[yt]++;
  }
  set<long double> st;
  vector<pair<long long, long long> > v;
  for (auto it : mp) {
    if (st.find(it.first) != st.end()) continue;
    long double cur = it.first;
    long double com = -(1.0 / cur);
    st.insert(cur);
    st.insert(com);
    v.push_back({mp[cur], mp[com]});
  }
  for (auto it : v) {
    long long temp = power(2, it.first, 1000000007) - 1;
    temp += power(2, it.second, 1000000007) - 1;
    temp++;
    if (temp < 0) temp += 1000000007;
    temp = temp % 1000000007;
    second = second * temp;
    second %= 1000000007;
  }
  long long temp = power(2, snd, 1000000007) - 1;
  temp += power(2, fst, 1000000007) - 1;
  temp++;
  second = second * (temp);
  second %= 1000000007;
  second--;
  second += you;
  if (second < 0) second += 1000000007;
  second = second % 1000000007;
  cout << second;
  return 0;
}
