class Solution {
public long solution(int w, int h) {
int wt = w;
int ht = h;
long answer = w;
// 유클리드 호제법
while(ht!=0){
int r = wt%ht;
wt = ht;
ht = r;
}
answer *= h;
answer -= (w+h-wt);
return answer;
}
}