Условие:

158
138
6050
30 + 40
6 + 610
7 + 710
2727
43 + 0

158 = 7
138 = 5
6050 = 10
30 + 40 = 70
6 + 610 = 1210 = 2
7 + 710 = 1410 = 4
2727 = 0
43 + 0 = 43