A robot is on a number line and is always located at an integer coordinate.
There are guidance signals in order. The -th signal consists of two integers .
When the robot is at coordinate and receives the -th signal, it repeats the following action exactly times.
Thus, at each repetition, the robot moves by at most one unit toward .
You are given independent queries. Each query consists of three integers . Place the robot initially at coordinate , then apply signals through in order.
Find the total distance that the robot actually moves during this process. The queries are independent of each other.
The input is given in the following format.
For each query, print the total distance actually traveled by the robot on its own line.