/* This program reads a sequence of integers and prints them out. It stops when
 * the input sequence diverts from the Fibonacci sequence.
 */

#include <stdio.h>

int main()
{
  int a1 = 1, a2 = 1, temp, input;

  scanf("%d", &input);
  printf("%d ",input);
  if (a1 != input)
    return 0;
  scanf("%d", &input);
  while (input ==  a2) {
    printf("%d ",input);
    temp = a1;
    a1 = a2;
    a2 = temp + a2;
    scanf("%d", &input);
  } 
  printf("%d\n",a2);
}
