import java.io.*; import java.util.*; class Main { public static void main(String args[])throws Exception { BufferedReader bu=new BufferedReader(new InputStreamReader(System.in)); StringBuilder sb=new StringBuilder(); String s[]=bu.readLine().split(" "); long a=Long.parseLong(s[0]),b=Long.parseLong(s[1]); long M=(int)1e9+7,x=a%M,y=b%M,ans=(x*2+1)*(y*2+1)%M; if(a%2==b%2) ans=(ans+1)*power(2,M-2,M)%M; else ans=(ans-1)*power(2,M-2,M)%M; System.out.println(ans); } static long power(long a,long b,long M) { long res=1; while(b!=0) { if(b%2==1) res=res*a%M; b>>=1; a=a*a%M; } return res; } }