
import java.util.*;

public class IvanTheFool {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();
		int m = sc.nextInt();

		long[] arr = new long[m];

		arr[0] = 2;
		if (m > 1) {
			arr[1] = 4;
		}

		for (int i = 2; i < arr.length; i++) {
			arr[i] = arr[i - 1] + arr[i - 2];
			arr[i] = arr[i] % 1000000007;
		}

		long ans = arr[arr.length - 1];
		long ans2 = (n - 1) * 2;
		ans = (ans + ans2) % 1000000007;
		System.out.println(ans);
	}

}
