Sum of array elements
Problem
Input
The first line contains the number
N
(
1<=N<=20
) - the number of elements of the one-dimensional array.
The second line contains
N
integers (numbers are entered from the keyboard).
The third line contains the integers
a
and
b
.
Imprint
Print the sum of array elements that are multiples of
a
or
b
.
Examples
# |
Input |
Output |
1 |
5
1 2 3 4 5
2 3
| 9 |
2 |
3
1 2 3
1 2
| 6 |
Запрещенные операторы: reverse
; min
; max
; sum