This page is still under construction.

Parts of this page are still being built. What you see may change.

Two Chickens (...)

Time limit2sMemory limit512 MB

Summary
Given two account balances and the price of one chicken, print the leftover total if two chickens can be afforded, otherwise the current total.
Level

Easy1 of 10

Topics
Implementation, Math, Brute force
Solved
No attempts yet

Problem

Sadly, the prizes for the 2017 Sunrin spring school contest are paid out of Ukje's bank accounts. Whether or not they know how Ukje feels, the participants keep begging for no fewer than two chickens (...) as the first prize.

Ukje has two bank accounts. Given the balances of both accounts and the price of one chicken, find out whether Ukje can buy two chickens (...). He can combine the balances of both accounts to pay.

Input

The first line contains the balances AA and BB of the two accounts. (0≤A,B≤1 000 000 0000 \le A, B \le 1\,000\,000\,000)

The second line contains the price CC of one chicken. (0≤C≤1 000 000 0010 \le C \le 1\,000\,000\,001)

Output

If Ukje can buy two chickens (...), print the sum of the two account balances left after buying them. Otherwise, print the current sum of the two account balances.

Examples3

  1. Example 1

    Input
    87 31
    20000
    
    Expected output
    118
    
  2. Example 2

    Input
    15000 6000
    5000
    
    Expected output
    11000
    
  3. Example 3

    Input
    1000000000 1000000000
    1000000001
    
    Expected output
    2000000000