def sum_times_tables(table,a,b):
    output = 0
    for n in range(a,b+1):
        for x in table:
            output+=x*n
    return output

'''
Write a function sumTimesTables which sums the result of the sums of the elements
 specified in tables multiplied by all the numbers in between min and max including themselves.

For example, for sumTimesTables([2,5],1,3) the result should be the same as

2*1 + 2*2 + 2*3 +
5*1 + 5*2 + 5*3

i.e. the table of two from 1 to 3 plus the table of five from 1 to 3

All the numbers are integers but you must take in account:

    tables could be empty.
    min could be negative.
    max could be really big.

'''