Under construction

Still being built. Things may change

Population

Time limit1sMemory limit1024 MB

Summary
Given a starting population and an elapsed time, the task asks for the population after that time, with one birth every 4 seconds and one death every 7 seconds.
Level

Easy1 of 10

Topics
Math, Implementation
Solved
No attempts yet

Problem

In Emily's country, a person dies every 7 seconds, and a person is born every 4 seconds. Given a beginning population, estimate the population after a certain period of time.

Input

The first line of input contains a single integer nn, the number of lines that follow. Each line contains two integers, pp and tt, where pp is the beginning population and tt is the amount of time that passes. Both pp and tt are between 1 and 2,000,000,000.

Output

Output the estimated population after the period of time based on the above statistics.

Examples1

  1. Example 1

    Input
    3
    12 14
    530 200
    4786 3543
    
    Expected output
    13
    552
    5165