#include <bits/stdc++.h>
using namespace std;
int read() {
  int x = 0;
  char ch = getchar();
  for (; ch < '0' || ch > '9'; ch = getchar())
    ;
  for (; ch >= '0' && ch <= '9'; ch = getchar())
    x = (x << 3) + (x << 1) + (ch ^ 48);
  return x;
}
int n, m;
bool flag;
int col[100010], vis[100010];
int in[100010], ver[100010 << 1], ne[100010 << 1], head[100010], tot;
void add(int x, int y) {
  in[x]++;
  in[y]++;
  ver[++tot] = y;
  ne[tot] = head[x];
  head[x] = tot;
  ver[++tot] = x;
  ne[tot] = head[y];
  head[y] = tot;
}
long long num[5];
void dfs(int u, int d) {
  if (!flag) return;
  if (!col[u])
    col[u] = d;
  else {
    if (col[u] != d) flag = false;
    return;
  }
  for (int i = head[u]; i; i = ne[i]) dfs(ver[i], d == 1 ? 2 : 1);
}
void calc(int u) {
  vis[u] = true;
  num[col[u]]++;
  for (int i = head[u], v; i; i = ne[i])
    if (!vis[v = ver[i]]) calc(v);
}
int main() {
  n = read();
  m = read();
  for (int i = 1; i <= m; i++) add(read(), read());
  if (m == 0) {
    printf("3 %I64d", (n - 2ll) * (n - 1ll) * (n - 0ll) / 6ll);
    return 0;
  }
  flag = true;
  for (int i = 1; i <= n; i++)
    if (in[i] > 1) {
      flag = false;
      break;
    }
  if (flag) {
    printf("2 %I64d", (n - 2ll) * m);
    return 0;
  }
  flag = true;
  for (int i = 1; i <= n; i++)
    if (!col[i]) {
      dfs(i, 1);
      if (!flag) {
        printf("0 1");
        return 0;
      }
    }
  long long ans = 0;
  for (int i = 1; i <= n; i++)
    if (!vis[i]) {
      num[1] = num[2] = 0;
      calc(i);
      ans += num[1] * (num[1] - 1ll) / 2ll + num[2] * (num[2] - 1ll) / 2ll;
    }
  printf("1 %I64d", ans);
  return 0;
}
