1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
def obr():
    # wall_size_w, wall_size_h = wall_size
    # wall_area = wall_size_w * wall_size_h
#    print(wall_area)
    wall_size_w, wall_size_h = list(map(int, input().split()))
    # print(wall_size_w, wall_size_h)
    kind = int(input())
    # print(kind)
    paint_size = list(map(int, input().split()))
    # print(paint_size)
    wall_area = wall_size_w * wall_size_h
    paint_count = 0
    rest = 0
    for i in range(0, kind):
        ps = paint_size[-(1 + i)]
        count = wall_area // (ps ** 2)
        rest = wall_area - count * (ps ** 2)
        paint_count += count
        wall_area = rest

    return paint_count if rest == 0 else -1



if __name__ == '__main__':
    # print(obr([6,10], 3, [1,3,6]))
    # print(obr([3,3], 1, [2]))
    print(obr())