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.math.BigInteger;
import java.util.*;
import java.io.*;
import java.text.*;

public class Main {
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in), 32768);
    static PrintWriter out = new PrintWriter(System.out);
    static StringTokenizer t;

    static String sn() {
        while (t == null || !t.hasMoreTokens()) {
            try {
                t = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                throw new RuntimeException();
            }
        }
        return t.nextToken();
    }

    static int ni() {
        return Integer.parseInt(sn());
    }

    static long nlo() {
        return Long.parseLong(sn());
    }

    static long mod = (long) 1000000007;

    static long pro(long a, long b) {
        return (a % mod * b % mod) % mod;
    }

    static long add(long a, long b) {
        return (a + b) % mod;
    }

    static long sub(long a, long b) {
        return ((a % mod - b % mod) + mod) % mod;
    }

    static int pow(int n) {
        return (int) (Math.log10(n) / Math.log10(2));
    }

    static long modpow(long x, long y) {
        long res = 1;
        x %= mod;
        while (y > 0) {
            if (y % 2 != 0)
                res = pro(res, x);
            x = pro(x, x);
            y /= 2;
        }
        return res;
    }

//    static class pair {
//        String a;
//        int b;
//
//        pair(String x, int y) {
//            a = x;
//            b = y;
//        }
//    }

    static long modInverse(long n) {
        BigInteger n1 = new BigInteger(Long.toString(n));
        String s = (n1.modInverse(new BigInteger(Long.toString(mod)))).toString();
        return Long.parseLong(s) % mod;
    }

    static boolean v[] = new boolean[1000005];

    static void seive() {
        v[1] = true;
        for (int i = 2; i < 1000005; i++) {
            if (!v[i]) {
                for (int j = 2 * i; j < 1000005; j += i)
                    v[j] = true;
            }
        }
    }

    static boolean isprime(long n) {
        if (n == 1)
            return false;
        for (int i = 2; i * i <= n; i++) {
            if (n % i == 0)
                return false;
        }
        return true;
    }

    static int gcd(int a, int b) {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }

    static DecimalFormat df = new DecimalFormat("0.00000000000");

    static class trie {
        trie a[] = new trie[26];
        int cnt = 0;
    }

    static int maxn = (int) 3e5 + 5;

    static long gcd(long a, long b) {
        if (b == 0)
            return a;
        else
            return gcd(b, a % b);
    }

    static void solve() {
        long n = nlo();
        int k = ni();
        int t = ni();
        if (t <= k)
            out.println(t);
        else if (t > k && t <= n)
            out.println(k);
        else if (t > n)
            out.println(k-t+n);
    }

    public static void main(String args[]) {
        int t = 1;
        while (t-- > 0) {
            solve();
        }
        out.close();
    }
}

