def fibonacci(k):
    """
    Calculates the kth Fibonacci number
    """

    if k == 0:
        return 0
    elif k == 1 or k == 2:
        return 1
    else:
        return fibonacci(k-1)+fibonacci(k-2)