Score : 2000 points
Snuke has R red balls and B blue balls. He distributes them into K boxes, so that no box is empty and no two boxes are identical. Compute the maximum possible value of K.
Formally speaking, let's number the boxes 1 through K. If Box i contains r_i red balls and b_i blue balls, the following conditions must be satisfied:
Input is given from Standard Input in the following format:
R B
Print the maximum possible value of K.
8 3
5
The following picture shows one possible way to achieve K = 5: