#include <bits/stdc++.h>
using namespace std;
inline int read() {
  register int x = 0, f = 1;
  register char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
inline void write(int x) {
  if (x < 0) x = -x, putchar('-');
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
const int N = 1e5 + 5;
int n, m, col[N], num[3];
long long ans2, ans3;
int cnt, to[200005], nxt[200005], first[N];
void add(int u, int v) {
  cnt++;
  to[cnt] = v;
  nxt[cnt] = first[u];
  first[u] = cnt;
}
bool dfs(int x, int c) {
  col[x] = c;
  num[c]++;
  for (int i = first[x]; i; i = nxt[i]) {
    int y = to[i];
    if (col[x] == col[y])
      return false;
    else if (!col[y]) {
      if (dfs(y, 3 - c) == false) return false;
    }
  }
  return true;
}
int main() {
  n = read();
  m = read();
  for (int i = 1; i <= m; i++) {
    int x = read(), y = read();
    add(x, y);
    add(y, x);
  }
  if (m == 0) {
    cout << 3 << ' ' << 1LL * n * (n - 1) * (n - 2) / 6;
    return 0;
  }
  int f0 = 1, f1 = 0;
  for (int i = 1; i <= n; i++) {
    if (col[i]) continue;
    num[1] = num[2] = 0;
    f0 &= dfs(i, 1);
    num[0] = num[1] + num[2];
    if (!f0) {
      cout << "0 1";
      return 0;
    }
    if (num[0] > 2) {
      ans3 += 1LL * num[1] * (num[1] - 1) / 2 + 1LL * num[2] * (num[2] - 1) / 2;
      f1 = 1;
    }
    if (num[0] == 2 && !f1) {
      ans2 += 1LL * (n - 2);
    }
  }
  if (f1)
    cout << 1 << ' ' << ans3;
  else
    cout << 2 << ' ' << ans2;
  return 0;
}
