#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

#pragma GCC optimize("O3")

using namespace std;
//using namespace __gnu_pbds;

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

#define int long long

//typedef tree<int, null_type,less<int>,  rb_tree_tag, tree_order_statistics_node_update> ordered_set;

const int mod = (int)1e9 + 7;

inline int sub(int a, int b){
    a%=mod;b%=mod;
    int res = a - b;
    if (res < 0) res += mod;
    return res;
}

inline int mul(int a, int b){
    a%=mod;
    b%=mod;
    return (a*b)%mod;
}

int bpow(int a, int n){
    int res = 1;
    while(n){
        if (n & 1) res = mul(res, a);
        a = mul(a, a);
        n>>=1;
    }
    return res;
}

signed main(){
    cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
    int n, m, cucumber;
    cin>>n>>m>>cucumber;
    vector<vector<int> > g(n), gr(n);
    for(int i = 0; i < m; ++i){
        int a, b;
        cin>>a>>b;
        --a; --b;
        g[a].push_back(b);
        gr[b].push_back(a);
    }
    cout<<m-1<<' '<<bpow(2,m-1)<<endl;
    return 0;
}
