#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef long long ll;
using namespace std;
const ll mod=1000000007;
int main(void){
    ll n;cin>>n;
    vector<ll> a(n),b(n);
    map<pair<ll,ll>,ll> mp;
    rep(i,n){
        cin>>a[i]>>b[i];
        ll buf=gcd(a[i],b[i]);
        //cout<<a[i]<<" "<<b[i]<<" "<<buf<<endl;
        mp[{a[i]/buf,b[i]/buf}]++;
    }
    
    vector<ll> s(n+1,1);//2^n
    rep(i,n) s[i+1]=s[i]*2;
    ll res=s[n]-1;
    ll inv=0,inv0=0;
    vector<pair<int,int>> memo;
    for(auto& p:mp){
        ll a=p.first.first,b=p.first.second,x=p.second;
        ll tmp=0;
        if(a==0&&b==0){
            inv0+=(s[x]-1)*s[n-x]-x;
            continue;
        }
        ll t1=mp[{-b,a}],t2=mp[{b,-a}];
        tmp+=(s[x]-1)*(s[t1]-1)*s[n-x-t1];
        tmp+=(s[x]-1)*(s[t2]-1)*s[n-x-t2];
        
        //ToDo 重複の処理
        
        if(t1!=0)memo.push_back({x,t1});
        if(t2!=0)memo.push_back({x,t2});
        inv+=tmp;
        inv%=mod;
    }
    inv/=2;
    cout<<inv<<endl;
    res=(mod+res-inv)%mod;
    cout<<res<<endl;
}