#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
vector<int> vec[N];
int n, m;
int vis[N], in[N];
long long color[N];
pair<long long, long long> pi[N];
void dfs(int u, int k) {
  int sz = vec[u].size();
  vis[u] = k;
  color[k]++;
  for (int i = 0; i < sz; i++) {
    int v = vec[u][i];
    if (vis[v] != -1) continue;
    if (k & 1)
      dfs(v, k - 1);
    else
      dfs(v, k + 1);
  }
}
int main() {
  int u, v;
  while (~scanf("%d%d", &n, &m)) {
    if (m == 0) {
      printf("3 %I64d", (long long)n * (n - 1) * (n - 2) / 6);
      continue;
    }
    memset(vis, -1, sizeof(vis));
    memset(vec, 0, sizeof(vec));
    memset(color, 0, sizeof(color));
    int k = -2, flag = 2;
    for (int i = 1; i <= m; i++) {
      scanf("%d%d", &u, &v);
      vec[u].push_back(v);
      vec[v].push_back(u);
      pi[i] = make_pair(u, v);
      in[u]++, in[v]++;
      if (in[u] > 1 || in[v] > 1) flag = -1;
    }
    if (flag == 2) {
      printf("2 %I64d\n", (long long)m * (n - 2));
      continue;
    }
    for (int i = 1; i <= n; i++) {
      if (vis[i] == -1) {
        k += 2;
        dfs(i, k);
      }
    }
    for (int i = 1; i <= m; i++) {
      if (vis[pi[i].first] == vis[pi[i].second]) {
        flag = 0;
        break;
      }
    }
    if (flag == 0) {
      puts("0 1");
      continue;
    }
    long long ans = 0;
    for (int i = 0; i <= k; i += 2) {
      if (color[i + 1] >= 2) {
        flag = 1;
        ans += (long long)color[i + 1] * (color[i + 1] - 1) / 2;
      }
      if (color[i] >= 2) {
        flag = 1;
        ans += (long long)color[i] * (color[i] - 1) / 2;
      }
    }
    if (flag == 1) {
      printf("1 %I64d\n", ans);
      continue;
    }
  }
  return 0;
}
