#K39097. Possible Coin Sums

    ID: 26344 Type: Default 1000ms 256MiB

Possible Coin Sums

Possible Coin Sums

You are given three integers A, B, and C, representing the coin rewards from three different quests. Your task is to find all distinct possible total coin sums that can be obtained by completing any combination (including the empty set) of quests. The answer should be a sorted list of unique sums.

Mathematically, if we define a subset S ⊆ {A, B, C}, you need to compute all possible \(\sum_{x \in S} x\) and output the sorted list of these sums.

inputFormat

The input consists of a single line containing three space-separated integers A, B, and C (each representing the coin reward of a quest).

For example:

4 6 8

outputFormat

Output a single line containing the sorted unique sums obtained by considering every combination of the given quests. The numbers should be separated by a single space.

For example:

0 4 6 8 10 12 14 18
## sample
4 6 8
0 4 6 8 10 12 14 18