#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
int in[maxn];
vector<int> g[maxn];
long long isThree(int n) {
  for (int i = 1; i <= n; i++)
    if (in[i]) return 0;
  return (long long)n * (n - 1) * (n - 2) / 6;
}
long long isTwo(int n) {
  int mm = 0;
  for (int i = 1; i <= n; i++)
    if (in[i] > 1)
      return 0;
    else if (in[i] == 1)
      ++mm;
  return (long long)mm * (n - 2) / 2;
}
int color[maxn];
int tot[3];
bool bipartite(int u) {
  ++tot[color[u]];
  for (int i = 0; i < g[u].size(); i++) {
    int v = g[u][i];
    if (color[v] == color[u]) return false;
    if (!color[v]) {
      color[v] = 3 - color[u];
      if (!bipartite(v)) return false;
    }
  }
  return true;
}
long long getC2(long long n) {
  if (n <= 1) return 0;
  return n * (n - 1) / 2;
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    ++in[u], ++in[v];
    g[u].push_back(v);
    g[v].push_back(u);
  }
  long long ans;
  if (ans = isThree(n))
    cout << "3 " << ans << endl;
  else if (ans = isTwo(n))
    cout << "2 " << ans << endl;
  else {
    ans = 0;
    for (int i = 1; i <= n; i++)
      if (color[i] == 0) {
        tot[1] = tot[2] = 0;
        color[i] = 1;
        if (!bipartite(i)) {
          ans = -1;
          break;
        } else
          ans += getC2(tot[1]) + getC2(tot[2]);
      }
    if (ans == -1)
      cout << "0 1" << endl;
    else
      cout << "1 " << ans << endl;
  }
  return 0;
}
