#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > g;
vector<vector<int> > com;
vector<int> col;
bool dfs(int i, int c, int C) {
  if (col[i] != -1) {
    if (col[i] != c) return false;
    return true;
  }
  col[i] = c;
  com[C].push_back(i);
  bool ok = true;
  for (int j = 0; j < g[i].size(); j++) {
    ok = ok && dfs(g[i][j], 1 - c, C);
  }
  return ok;
}
int main() {
  int n, m;
  cin >> n >> m;
  g = vector<vector<int> >(n);
  col = vector<int>(n, -1);
  for (int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    a--;
    b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  bool done = false;
  for (int i = 0; i < n; i++) {
    if (col[i] == -1) {
      com.push_back(vector<int>());
      done = done || (!dfs(i, 0, com.size() - 1));
    }
  }
  if (done) {
    cout << 0 << " " << 1 << endl;
    return 0;
  }
  long long res = 0;
  for (int i = 0; i < com.size(); i++) {
    long long r, b;
    r = b = 0;
    for (int j = 0; j < com[i].size(); j++) {
      if (col[com[i][j]])
        r++;
      else
        b++;
    }
    res += r * (r - 1) / 2;
    res += b * (b - 1) / 2;
  }
  if (res) {
    cout << 1 << " " << res << endl;
    return 0;
  }
  for (int i = 0; i < com.size(); i++) {
    if (com[i].size() > 1) {
      res += (n - 2);
    }
  }
  if (res) {
    cout << 2 << " " << res << endl;
    return 0;
  }
  cout << 3 << " " << n * (n - 1ll) * (n - 2ll) / 6 << endl;
}
