import java.util.*;

public class KosyaReshaetZadachi {

    public static void main (String[] args) {
        Scanner scan = new Scanner(System.in);

        long n = scan.nextInt();
        long m = scan.nextInt();

        System.out.println( (n * m + 2) % 1000000007);

    }
}