输入样例:
3 4 -5 2 6 1 -2 0
输出样例:
12 3 -10 1 6 0
# -*- coding: utf-8 -*-def get_derivation(lst):length = len(lst)idx = 0while idx < length:if lst[idx + 1] != 0:lst[idx] *= lst[idx + 1]lst[idx + 1] -= 1else:lst[idx] = 0idx += 2return lstif __name__ == '__main__':input_list = (input()).split()input_list = list(map(lambda x: eval(x), input_list))result = get_derivation(input_list)if result[0] == 0:print(0, 0)else:if not (result[-1] or result[-2]):del result[-2:]print(' '.join(map(str, result)))