#include <iostream>
#include <cstdio>
#include <vector>

namespace SuperI{
	const int MBUF = 2 << 21;
	std::streambuf *inbuf = std::cin.rdbuf();
	char buf[MBUF], *head = buf, *tail = buf, ___c;
	inline char getchar() {
		if ((head == tail) && (tail = (head = buf) + inbuf->sgetn(buf, MBUF), head == tail)) return EOF;
		else return *head++;
	}
	inline void read(int *const p) {
		*p = 0;
		for (___c = getchar(); ___c < '0' || ___c > '9';)
		___c = getchar();
		for (; ___c >= '0' && ___c <= '9'; *p = *p * 10 + (___c ^ 48), ___c = getchar());
	}
	inline void read(long long *const p) {
		*p = 0;
		for (___c = getchar(); ___c < '0' || ___c > '9'; ___c = getchar());
		for (; ___c >= '0' && ___c <= '9'; *p = *p * 10 + (___c ^ 48), ___c = getchar());
	}
}

const long long MOD = 1e9 + 7;
int n, m;
long long ans;

int main() {
	using SuperI::read;
	freopen("barrack.in", "r", stdin);
	freopen("barrack.out", "w", stdout);
	
	read(&n);
	read(&m);
	ans = (ans + (1ll * n * (1 << (n - 1)) % MOD)) % MOD;
	for (int i = 2; i <= n; ++i) {
		long long tmp = 1;
		for (int j = i - 1; j < n; ++j) {
			ans = (ans + (tmp * (1 << (n - 1 - j)) % MOD)) % MOD;
			tmp = tmp * (j + 2) / (j + 2 - i);
		}
	}
	std::cout << ans;

	fclose(stdin);
	fclose(stdout);
	return 0;
}
