Language: C++

#include<iostream>
#include<iomanip>
#include<map>
#include<set>
#include<vector>
#include<string>
#include<stack>
#include<array>
#include<queue>
#include<algorithm>
#include<cassert>
#include<functional>
#include<numeric>
#include<random>
#define int int64_t
#define REP(i, a, b) for (int64_t i = (int64_t)(a); i < (int64_t)(b); i++)
#define rep(i, a) REP(i, 0, a)
#define EACH(i, a) for (auto i: a)
#define ITR(x, a) for (auto x = a.begin(); x != a.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define HAS(a, x) (a.find(x) != a.end())
using namespace std;

//MODが素数であることを前提として実装してあるが、その判定はしていない。
//あまりが出るような除算をしてはいけない。
template<int MOD = 1000000007>class modint {
public:
	modint() {
		this->number = 0;
	}
	modint(int src) {
		this->number = src;
	}
	modint<MOD> operator + (modint<MOD> obj) {
		modint re((this->number + obj.number) % MOD);
		return re;
	}
	modint<MOD> operator + (int n) {
		modint re((this->number + opposit(n)) % MOD);
		return re;
	}
	modint<MOD>& operator += (modint<MOD>& obj) {
		this->number = (this->number + obj.number) % MOD;
		return *this;
	}
	modint<MOD>& operator += (int n) {
		this->number = (this->number + opposit(n)) % MOD;
		return *this;
	}
	modint<MOD> operator - (modint<MOD> obj) {
		modint re((this->number - obj.number + MOD) % MOD);
		return re;
	}
	modint<MOD> operator - (int n) {
		modint re((this->number - opposit(n) + MOD) % MOD);
		return re;
	}
	modint<MOD>& operator -= (modint<MOD>& obj) {
		this->number = (this->number - obj.number + MOD) % MOD;
		return *this;
	}
	modint<MOD>& operator -= (int n) {
		this->number = (this->number - opposit(n) + MOD) % MOD;
		return *this;
	}
	modint<MOD> operator * (modint<MOD> obj) {
		modint re((this->number * obj.number) % MOD);
		return re;
	}
	modint<MOD> operator * (int n) {
		modint re((this->number * opposit(n)) % MOD);
		return re;
	}
	modint<MOD>& operator *= (modint<MOD>& obj) {
		this->number = (this->number * obj.number) % MOD;
		return *this;
	}
	modint<MOD>& operator *= (int n) {
		this->number = (this->number * opposit(n)) % MOD;
		return *this;
	}
	modint<MOD> operator / (modint<MOD> obj) {
		modint re((this->number * inverse(obj.number)) % MOD);
		return re;
	}
	modint<MOD> operator / (int n) {
		modint re((this->number * inverse(n)) % MOD);
		return re;
	}
	modint<MOD>& operator /= (modint<MOD>& obj) {
		this->number = (this->number * inverse(obj.number)) % MOD;
		return *this;
	}
	modint<MOD>& operator /= (int n) {
		this->number = (this->number * inverse(n)) % MOD;
		return *this;
	}
	modint operator = (int n) {
		this->number = opposit(n) % MOD;
		return *this;
	}
	int get() {
		return number;
	}

private:
	int number;

	int opposit(int n) {
		if (n < 0)n = MOD - ((-n) % MOD);
		return n % MOD;
	}
	int inverse(int n) {
		n = opposit(n);
		int result = 1;
		for (int i = MOD - 2; i; i /= 2) {
			if (i % 2)result = (result * n) % MOD;
			n = (n * n) % MOD;
		}
		return result;
	}
};

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int H, W, A, B;
	cin >> H >> W >> A >> B;

	vector<modint<>>facto(H + W + 1);
	facto[0] = 1;
	REP(i, 1, facto.size())facto[i] = facto[i - 1] * i;





	int edgeh = H - A - 1;
	int edgew = B;
	modint<> result(0);
	while (0 <= edgeh && edgew < W) {
		//初期位置からedgeまでのパターン
		modint<>ans1 = facto[edgeh + edgew] / (facto[edgeh] * facto[edgew]);

		//edgeからゴールまでのパターン
		int eh2 = H - edgeh - 1;
		int ew2 = W - edgew - 1;
		modint<>ans2 = facto[eh2 + ew2] / (facto[eh2] * facto[ew2]);

		result += (ans1 * ans2);

		edgeh--;
		edgew++;
	}

	cout << result.get() << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:151:33: error: cannot bind non-const lvalue reference of type 'modint<>&' to an rvalue of type 'modint<>'
  151 |                 result += (ans1 * ans2);
      |                           ~~~~~~^~~~~~~
a.cc:42:48: note:   initializing argument 1 of 'modint<MOD>& modint<MOD>::operator+=(modint<MOD>&) [with long int MOD = 1000000007]'
   42 |         modint<MOD>& operator += (modint<MOD>& obj) {
      |                                   ~~~~~~~~~~~~~^~~