#C12472. Fibonacci with a Twist

    ID: 41903 Type: Default 1000ms 256MiB

Fibonacci with a Twist

Fibonacci with a Twist

You are given three values a, b, and n representing two starting numbers and the length of a sequence respectively. The task is to generate a sequence of n numbers where:

\(F(1) = a,\quad F(2) = b\)

For each subsequent index \(i\) (starting from 3), if \(i\) is odd then the next number is computed as the sum of the previous two numbers, i.e., \[ F(i) = F(i-1) + F(i-2), \] otherwise, if \(i\) is even then the next number is computed as the product of the previous two numbers, i.e., \[ F(i) = F(i-1) \times F(i-2). \]

Note that all inputs must be positive integers. If any of the inputs are not integers, output the error message:

Invalid input: All input values must be integers

If any of the inputs is non-positive, output the error message:

Invalid input: All input values must be positive integers

inputFormat

The program reads a single line from standard input containing three space-separated values representing a, b, and n.

outputFormat

If the inputs are valid, output the sequence as space-separated numbers in a single line. Otherwise, output the corresponding error message.## sample

2 3 6
2 3 5 15 20 300