# Enter your code here. Read input from STDIN. Print output to STDOUT size = gets.chomp.split(' ') height = size[0].to_i width = size[1].to_i cuts = height - 1 + (width - 1) * height puts cuts