#include <bits/stdc++.h>
using namespace std;
const int Maxn = 2e6 + 100;
int n, m, flag, cnt[2], vis[Maxn], p[Maxn];
vector<int> e[Maxn];
long long ans;
void dfs(int i, int f) {
  cnt[f]++;
  p[i] = f;
  vis[i] = 1;
  for (int u : e[i])
    if (!vis[u]) dfs(u, !f);
}
int main() {
  ios::sync_with_stdio(0);
  cin >> n >> m;
  if (m == 0) {
    cout << 3 << " " << 1LL * n * (n - 1) * (n - 2) / 6 << endl;
    return 0;
  }
  int i;
  for (i = 1; i <= m; i++) {
    int x, y;
    cin >> x >> y;
    e[x].push_back(y);
    e[y].push_back(x);
  }
  for (i = 1; i <= n; i++) {
    if (e[i].size() > 1) flag = 1;
    if (!vis[i]) {
      cnt[0] = cnt[1] = 0;
      dfs(i, 1);
      ans += (1LL * cnt[0] * (cnt[0] - 1) >> 1) +
             (1LL * cnt[1] * (cnt[1] - 1) >> 1);
    }
    for (int u : e[i])
      if (p[u] == p[i]) {
        cout << 0 << " " << 1 << endl;
        return 0;
      }
  }
  if (flag)
    cout << 1 << " " << ans << endl;
  else
    cout << 2 << " " << 1LL * (n - 2) * m << endl;
  return 0;
}
