D. Dragon Balls
time limit per test
9 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Examples
Input
1
4 3
Output
5
Input
2
4 3
5 5
Output
12