Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ACM-ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

A. Arpa and a research in Mexican wave

time limit per test

1 secondmemory limit per test

256 megabytesinput

standard inputoutput

standard outputArpa is researching the Mexican wave.

There are *n* spectators in the stadium, labeled from 1 to *n*. They start the Mexican wave at time 0.

- At time 1, the first spectator stands.
- At time 2, the second spectator stands.
- ...
- At time
*k*, the*k*-th spectator stands. - At time
*k*+ 1, the (*k*+ 1)-th spectator stands and the first spectator sits. - At time
*k*+ 2, the (*k*+ 2)-th spectator stands and the second spectator sits. - ...
- At time
*n*, the*n*-th spectator stands and the (*n*-*k*)-th spectator sits. - At time
*n*+ 1, the (*n*+ 1 -*k*)-th spectator sits. - ...
- At time
*n*+*k*, the*n*-th spectator sits.

Arpa wants to know how many spectators are standing at time *t*.

Input

The first line contains three integers *n*, *k*, *t* (1 ≤ *n* ≤ 10^{9}, 1 ≤ *k* ≤ *n*, 1 ≤ *t* < *n* + *k*).

Output

Print single integer: how many spectators are standing at time *t*.

Examples

Input

10 5 3

Output

3

Input

10 5 7

Output

5

Input

10 5 12

Output

3

Note

In the following a sitting spectator is represented as -, a standing spectator is represented as ^.

- At
*t*= 0 ---------- number of standing spectators = 0. - At
*t*= 1 ^--------- number of standing spectators = 1. - At
*t*= 2 ^^-------- number of standing spectators = 2. - At
*t*= 3 ^^^------- number of standing spectators = 3. - At
*t*= 4 ^^^^------ number of standing spectators = 4. - At
*t*= 5 ^^^^^----- number of standing spectators = 5. - At
*t*= 6 -^^^^^---- number of standing spectators = 5. - At
*t*= 7 --^^^^^--- number of standing spectators = 5. - At
*t*= 8 ---^^^^^-- number of standing spectators = 5. - At
*t*= 9 ----^^^^^- number of standing spectators = 5. - At
*t*= 10 -----^^^^^ number of standing spectators = 5. - At
*t*= 11 ------^^^^ number of standing spectators = 4. - At
*t*= 12 -------^^^ number of standing spectators = 3. - At
*t*= 13 --------^^ number of standing spectators = 2. - At
*t*= 14 ---------^ number of standing spectators = 1. - At
*t*= 15 ---------- number of standing spectators = 0.

Codeforces (c) Copyright 2010-2018 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: May/22/2018 01:33:09 (d2).

Desktop version, switch to mobile version.

User lists

Name |
---|