Language: C++

#include <cstdint>

#include <iostream>

template <std::uint_fast64_t MOD> class ModInt {
  using u64 = std::uint_fast64_t;

public:
  ModInt(const u64 val = 0) { value = val % MOD; }

  bool operator==(const ModInt &rhs) const { return value == rhs.value; }
  bool operator!=(const ModInt &rhs) const { return !(*this == rhs); }
  bool operator<(const ModInt &rhs) const { return value < rhs.value; }
  bool operator>(const ModInt &rhs) const { return value > rhs.value; }
  bool operator<=(const ModInt &rhs) const { return !(*this > rhs); }
  bool operator>=(const ModInt &rhs) const { return !(*this < rhs); }

  ModInt operator+(const ModInt rhs) const { return ModInt(*this) += rhs; }
  ModInt operator-(const ModInt rhs) const { return ModInt(*this) -= rhs; }
  ModInt operator*(const ModInt rhs) const { return ModInt(*this) *= rhs; }
  ModInt operator/(const ModInt rhs) const { return ModInt(*this) /= rhs; }

  ModInt &operator+=(const ModInt rhs) {
    value += rhs.value;
    if (value >= MOD) {
      value -= MOD;
    }
    return *this;
  }

  ModInt &operator-=(const ModInt rhs) {
    if (value < rhs.value) {
      value += MOD;
    }
    value -= rhs.value;
    return *this;
  }

  ModInt &operator*=(const ModInt rhs) {
    value = value * rhs.value % MOD;
    return *this;
  }

  ModInt &operator/=(ModInt rhs) {
    *this *= rhs.inv();
    return *this;
  }

  ModInt &operator++(int n) {
    value++;
    if (value >= MOD) {
      value -= MOD;
    }
    return *this;
  }

  ModInt &operator--(int n) {
    if (value == 0) {
      value += MOD;
    }
    value--;
    return *this;
  }

  ModInt inv() { return ModInt::pow(*this, MOD - 2); }

  static ModInt pow(ModInt base, long long int n) {
    ModInt res = ModInt(1);
    while (n) {
      if (n & 1) {
        res *= base;
      }
      base *= base;
      n /= 2;
    }
    return res;
  }

  static ModInt comb(ModInt n, ModInt r) { return comb(n.value, r.value); }

  static ModInt comb(int n, int r) {
    if (n < r)
      return ModInt(0);
    ModInt res = ModInt(1);
    for (int i = 0; i < r; i++) {
      res *= mint(n - i);
    }

    ModInt inv = ModInt(1);
    for (int i = 0; i < r; i++) {
      inv *= mint(r - i);
    }
    return res / inv;
  }

  u64 getValue() const { return value; }

private:
  u64 value;
};

// ここを問題ごとのMODに書き換える
using mint = ModInt<1000000007>;

std::ostream &operator<<(std::ostream &out, const mint &m) {
  out << m.getValue();
  return out;
};

std::istream &operator>>(std::istream &in, mint &m) {
  uint_fast64_t i;
  in >> i;
  m = mint(i);
  return in;
}

// verify https://atcoder.jp/contests/abc127/tasks/abc127_e
int main() {
  mint n, m, k;
  std::cin >> n >> m >> k;
  mint ans = mint(0);
  mint kumi = mint::comb(n * m - mint(2), k - mint(2));
  for (int d = 1; d < n.getValue(); d++) {
    ans += (mint(d) * (n - mint(d)) * m * m * kumi);
  }
  for (int d = 1; d < m.getValue(); d++) {
    ans += (mint(d) * (m - mint(d)) * n * n * kumi);
  }
  std::cout << ans << std::endl;
}


Compiler output:
a.cc: In static member function 'static ModInt<MOD> ModInt<MOD>::comb(int, int)':
a.cc:86:14: error: there are no arguments to 'mint' that depend on a template parameter, so a declaration of 'mint' must be available [-fpermissive]
   86 |       res *= mint(n - i);
      |              ^~~~
a.cc:86:14: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
a.cc:91:14: error: there are no arguments to 'mint' that depend on a template parameter, so a declaration of 'mint' must be available [-fpermissive]
   91 |       inv *= mint(r - i);
      |              ^~~~
a.cc: In instantiation of 'static ModInt<MOD> ModInt<MOD>::comb(int, int) [with long unsigned int MOD = 1000000007]':
a.cc:79:55:   required from 'static ModInt<MOD> ModInt<MOD>::comb(ModInt<MOD>, ModInt<MOD>) [with long unsigned int MOD = 1000000007]'
   79 |   static ModInt comb(ModInt n, ModInt r) { return comb(n.value, r.value); }
      |                                                   ~~~~^~~~~~~~~~~~~~~~~~
a.cc:122:25:   required from here
  122 |   mint kumi = mint::comb(n * m - mint(2), k - mint(2));
      |               ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:86:18: error: expected primary-expression
   86 |       res *= mint(n - i);
      |              ~~~~^~~~~~~
a.cc:91:18: error: expected primary-expression
   91 |       inv *= mint(r - i);
      |              ~~~~^~~~~~~