import java.io.*;
import java.util.*;
 
public class main {	
	static final int MOD = 1000000007;
	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st = new StringTokenizer(br.readLine());
		
		int n = Integer.parseInt(st.nextToken());
		int m = Integer.parseInt(st.nextToken());
		long ans = n*2;
		ans %= MOD;
		ans += (m-1)*2;
		ans %= MOD;
		System.out.println(ans);
	}
}