The Pattering of Cats
In a city, residents frequently complained about disturbances during their sleep. Each day, officials received a substantial number of complaints regarding excessive nighttime noise. To address this issue, a decision was made at a subsequent meeting to enact a law prohibiting loud noises after 11 PM.
In line with bureaucratic procedures, the law needed to define "loud noise." After deliberation, it was decided to ban activities such as playing musical instruments, moving furniture, and hammering nails at night.
As the law was about to be enacted, a deputy pointed out that a refrigerator is not classified as furniture, so moving it wouldn't be covered by the law. This led other deputies to propose additional prohibitions that were not initially included. Consequently, noises like groans, creaks, dog barking, and cat stomping were also banned.
A fine of a rubles was established for violations of the law.
Upon hearing about the law, Petya wanted to determine the potential fines for the residents of his building. Petya's building has n floors, with m apartments on each floor. The apartments are numbered consecutively from 1 to nm. If an apartment is numbered x and is not on the top floor, the apartment directly above it is numbered x+m.
It is known that the i-th apartment has b_i cats. Petya assumed that residents would complain about their upstairs neighbors only if the cats above stomp significantly louder than their own. After conducting experiments, Petya concluded that p cats stomp significantly louder than q cats if p > 2q.
Calculate the total fine that the building's residents will incur if every resident whose upstairs neighbors' cats stomp significantly louder than their own cats files a complaint, resulting in a fine.
Input
The first line of the input contains three integers n, m, a — representing the number of floors, the number of apartments per floor, and the fine amount (1 ≤ n ≤ 20, 1 ≤ m ≤ 10, 1 ≤ a ≤ 1000). The next line contains nm integers b_1, b_2, ..., b_nm, where b_i is the number of cats in the i-th apartment (1 ≤ b_i ≤ 30).
Output
Output the total fine that will be imposed.