#include <bits/stdc++.h>
const int INF = 1e9;
using namespace std;
vector<int> a[1000000];
int col[1000000];
long long k1;
int dfs(int v, int c) {
  col[v] = c;
  if (c == 1) {
    k1++;
  }
  int res = 1;
  for (int i = 0; i < (int)a[v].size(); i++) {
    if (col[a[v][i]] == c) {
      cout << "0 1";
      exit(0);
    }
    if (!col[a[v][i]]) {
      res += dfs(a[v][i], 3 - c);
    }
  }
  return res;
}
int main() {
  int n, m, x, y;
  cin >> n >> m;
  bool b = 0;
  for (int i = 0; i < (int)m; i++) {
    cin >> x >> y;
    a[--x].push_back(--y);
    a[y].push_back(x);
    if (a[x].size() > 1 || a[y].size() > 1) {
      b = 1;
    }
  }
  if (m == 0) {
    cout << 3 << " " << 1ll * n * (n - 1) * (n - 2) / 6;
    exit(0);
  }
  if (!b) {
    cout << 2 << " " << 1ll * m * (n - 2);
    exit(0);
  }
  long long res = 0;
  for (int i = 0; i < (int)n; i++) {
    if (!col[i]) {
      k1 = 0;
      long long k = dfs(i, 1);
      res += k1 * (k1 - 1) / 2 + (k - k1) * (k - k1 - 1) / 2;
    }
  }
  cout << "1 " << res;
  return 0;
}
