#K84942. Fibonacci-Style Sequence

    ID: 36531 Type: Default 1000ms 256MiB

Fibonacci-Style Sequence

Fibonacci-Style Sequence

Given two starting integers, your task is to compute the N-th term of a Fibonacci-style sequence. The sequence is defined as follows:

\(F(1)=first\), \(F(2)=second\), and for all \(n \ge 3\),\(F(n)=F(n-1)+F(n-2)\).

You are required to read the input from stdin and output the result to stdout.

inputFormat

The input consists of a single line containing three space-separated integers: first, second, and N, where:

  • first is the first term of the sequence.
  • second is the second term of the sequence.
  • N indicates that the N-th term of the sequence is to be computed.

Example: 2 3 5

outputFormat

Output a single integer --- the N-th term of the sequence.

## sample
2 3 5
13