cho.sh
Notes
Loading...

Actual Disk Space

Time limit

2s

Memory limit

128 MB

Problem

In some file systems, a file's size and the amount of disk space it actually occupies are not always the same. This happens because the disk is divided into clusters of a fixed size, and each cluster can be assigned to only one file.

For example, if the cluster size is 512 bytes, storing a 600-byte file requires 2 clusters. The unused space in those clusters cannot be used by another file, so the file occupies 1024 bytes of disk space.

Given the sizes of the files and the cluster size, compute the total amount of disk space actually occupied by all files. A file of size 0 occupies no cluster.

Input

The first line contains the number of files N. N is a positive integer not greater than 50.

The second line contains the sizes of the N files, separated by spaces. Each file size is a non-negative integer not greater than 1,000,000,000.

The third line contains the cluster size. The cluster size is a positive integer not greater than 1,048,576.

Output

Print one line containing the total disk space actually used by all files, in bytes.