Arpa 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 ≤ 109, 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  ---------- <image> number of standing spectators = 0. 
  * At t = 1  ^--------- <image> number of standing spectators = 1. 
  * At t = 2  ^^-------- <image> number of standing spectators = 2. 
  * At t = 3  ^^^------- <image> number of standing spectators = 3. 
  * At t = 4  ^^^^------ <image> number of standing spectators = 4. 
  * At t = 5  ^^^^^----- <image> number of standing spectators = 5. 
  * At t = 6  -^^^^^---- <image> number of standing spectators = 5. 
  * At t = 7  --^^^^^--- <image> number of standing spectators = 5. 
  * At t = 8  ---^^^^^-- <image> number of standing spectators = 5. 
  * At t = 9  ----^^^^^- <image> number of standing spectators = 5. 
  * At t = 10 -----^^^^^ <image> number of standing spectators = 5. 
  * At t = 11 ------^^^^ <image> number of standing spectators = 4. 
  * At t = 12 -------^^^ <image> number of standing spectators = 3. 
  * At t = 13 --------^^ <image> number of standing spectators = 2. 
  * At t = 14 ---------^ <image> number of standing spectators = 1. 
  * At t = 15 ---------- <image> number of standing spectators = 0. 
import java.io.*;
import java.util.*;

public class Main {
    static final String fileName = "LLIAMA3OB";

    static void solutionA() {
        int n = fs.nextInt(), k = fs.nextInt(), t = fs.nextInt();
        if (t < k) {pw.print(t);
        return;}
        if (t < n) {
            pw.print(k);
            return;
        }
        pw.print(n + k - t);
    }

    static void solutionB() {
        long ax = fs.nextInt(), ay = fs.nextInt(),bx = fs.nextInt(),by = fs.nextInt(), cx = fs.nextInt(), cy = fs.nextInt(), x1 = ax - bx, x2 = bx - cx, y1 = ay - by, y2 = by - cy;
        if (((x1*x1 + y1*y1) == (x2*x2 + y2*y2)) && (x1*y2 != x2*y1)){
            pw.print("Yes");
        } else {
            pw.print("No");
        }
    }

    public static void main(String[] args) {
        try {
            fs = new FastScanner(new FileInputStream(fileName + ".in"));
            pw = new PrintWriter(new BufferedOutputStream(new FileOutputStream(fileName + ".out")));
        } catch (IOException e) {
            fs = new FastScanner(System.in);
            pw = new PrintWriter(new BufferedOutputStream(System.out));
        }
        solutionA();
        pw.close();
    }

    static PrintWriter pw;
    static FastScanner fs;

    static class FastScanner {
        BufferedReader br;
        StringTokenizer tokenizer;

        public FastScanner(InputStream stream) {
            br = new BufferedReader(new InputStreamReader(stream));
        }

        private String readLine() {
            try {
                return br.readLine();
            } catch (IOException e) {
                return null;
            }
        }

        public String nextToken() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(readLine());
            }
            return tokenizer.nextToken();
        }

        public byte nextByte() {
            return Byte.parseByte(nextToken());
        }

        public short nextShort() {
            return Short.parseShort(nextToken());
        }

        public int nextInt() {
            return Integer.parseInt(nextToken());
        }

        public long nextLong() {
            return Long.parseLong(nextToken());
        }

        public double nextDouble() {
            return Double.parseDouble(nextToken());
        }

        public boolean hasMoreTokens() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                String s = readLine();
                if (s == null) {
                    return false;
                }
                tokenizer = new StringTokenizer(readLine());
            }
            return tokenizer.hasMoreTokens();
        }
    }
}
