if len(set(line[:3])) == 1:
income_amount += values[line[:3]]
elif 'D' in set(line[:3]) and len(set(line[:3])) == 2:
income_amount += values[line[:3].replace('D', set(line[:3])-{'D'})]
if len(set(line[3:6])) == 1:
income_amount += values[line[3:6]]
elif 'D' in set(line[3:6]) and len(set(line[3:6])) == 2:
income_amount += values[line[3:6].replace('D', set(line[3:6])-{'D'})]