#include <bits/stdc++.h>
using namespace std;
long long n, m, col[200005];
vector<long long> g[200005];
vector<long long> s1, s2;
bool flag, vis[200005];
vector<pair<long long, pair<long long, long long> > > cc;
void dfs(long long node, long long color, long long par) {
  if (vis[node]) {
    if (col[node] == color) return;
    flag = 1;
    return;
  }
  vis[node] = 1;
  col[node] = color;
  if (color == 1)
    s1.push_back(node);
  else
    s2.push_back(node);
  long long sz = g[node].size();
  for (long long i = 0; i <= sz - 1; i++) {
    long long child = g[node][i];
    if (child != par) dfs(child, 1 - color, node);
  }
}
int main() {
  std::ios::sync_with_stdio(false);
  cin >> n >> m;
  for (long long i = 1; i <= m; i++) {
    long long u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  long long sz = 0;
  for (long long i = 1; i <= n; i++) {
    if (!vis[i]) {
      dfs(i, 1, -1);
      long long a = s1.size();
      long long b = s2.size();
      cc.push_back(make_pair(a + b, make_pair(a, b)));
      s1.clear();
      s2.clear();
    }
  }
  sz = cc.size();
  if (flag) {
    cout << "0 1" << endl;
    return 0;
  }
  long long ans = 0ll;
  sort(cc.begin(), cc.end());
  if (cc[sz - 1].first > 2ll) {
    cout << "1 ";
    for (long long i = 0; i <= sz - 1; i++)
      ans = ans + ((cc[i].second.first) * (cc[i].second.first - 1ll)) / 2ll +
            ((cc[i].second.second) * (cc[i].second.second - 1ll)) / 2ll;
  } else if (cc[sz - 1].first == 2) {
    cout << "2 ";
    long long cnt = 0;
    for (long long i = 0; i <= sz - 1; i++) {
      if (cc[i].first == 2) cnt++;
    }
    ans = cnt * (n - 2ll);
  } else {
    cout << "3 ";
    ans = n * (n - 1ll) * (n - 2ll);
    ans /= 6ll;
  }
  cout << ans << endl;
  return 0;
}
