@@ -0,0 +1,2018 @@
+%22%22%22%0AProgram to solve 2009 Lithuanian national exams main session first task.%0AMade by Ignas Kiela, 2018%0A%22%22%22%0A%0A%0Adef calculate_nominals(nominals, ammount):%0A    %22%22%22%0A    Calculates the required nominals for the ammount%0A    Uses a simple algorythm, should be self explanatory%0A    Requires nominal list to be sorted in descending order%0A    %22%22%22%0A    result = %5B%5D%0A    for nominal in nominals:%0A        result.append(ammount // nominal)%0A        ammount %25= nominal%0A    return result%0A%0A%0Adef output_results(nominals, ammounts, output_stream):%0A    %22%22%22%0A    Outputs the results in required format%0A    %22%22%22%0A    for nominal, ammount in zip(nominals, ammounts):%0A        output_stream.write(''.join((str(nominal), str(ammount))))%0A    output_stream.write(str(sum(ammounts)))%0A%0A%0Adef calculate_sum(nominals, ammounts):%0A    %22%22%22%0A    Calculates the sum of money%0A    %22%22%22%0A    return sum(%0A        %5Bnominal * ammount for nominal, ammount in zip(nominals, ammounts)%5D)%0A%0A%0Adef run(input_stream, output_stream):%0A    %22%22%22%0A    Does the task%0A    %22%22%22%0A    input_stream.readline()  #Unnescesary data%0A    gilija_nom = %5Bint(x) for x in input_stream.readline().split()%5D%0A    gilijos_tur = %5Bint(x) for x in input_stream.readline().split()%5D%0A    input_stream.readline()  #Unnescesary data%0A    eglija_nom = %5Bint(x) for x in input_stream.readline().split()%5D%0A    eglijos_tur = %5Bint(x) for x in input_stream.readline().split()%5D%0A%0A    gilijos_sum = calculate_sum(gilija_nom, gilijos_tur)%0A    eglijos_sum = calculate_sum(eglija_nom, eglijos_tur)%0A%0A    #prepare the data for calculations%0A    eglija_nom.sort(reverse=True)%0A    gilija_nom.sort(reverse=True)%0A%0A    #calculate the results%0A    gilija_rez = calculate_nominals(eglija_nom, gilijos_sum)%0A    eglija_rez = calculate_nominals(gilija_nom, eglijos_sum)%0A%0A    #output results%0A    output_results(eglija_nom, gilija_rez, output_stream)%0A    output_results(gilija_nom, eglija_rez, output_stream)%0A%0A%0Aif __name__ == '__main__':%0A    input_file = open('U1.txt', 'r')%0A    output_file = open('U1rez.txt', 'w')%0A    run(input_file, output_file)%0A

This task