import collections


def nth_fibonacci(nth_term: int) -> int:
    """Given n, find the corresponding value in the Fibonacci sequence."""

    latest_fibonacci_numbers = collections.deque([0, 1], maxlen=2)

    if nth_term < 2:
        result = latest_fibonacci_numbers[nth_term]
    else:
        result = sum(latest_fibonacci_numbers)
        for _ in range(2, nth_term):
            latest_fibonacci_numbers.append(result)
            result = sum(latest_fibonacci_numbers)

    return result