CF366E Dima and Magic Guitar

Description

Dima loves Inna very much. He decided to write a song for her. Dima has a magic guitar with $ n $ strings and $ m $ frets. Dima makes the guitar produce sounds like that: to play a note, he needs to hold one of the strings on one of the frets and then pull the string. When Dima pulls the $ i $ -th string holding it on the $ j $ -th fret the guitar produces a note, let's denote it as $ a_{ij} $ . We know that Dima's guitar can produce $ k $ distinct notes. It is possible that some notes can be produced in multiple ways. In other words, it is possible that $ a_{ij}=a_{pq} $ at $ (i,j)≠(p,q) $ . Dima has already written a song — a sequence of $ s $ notes. In order to play the song, you need to consecutively produce the notes from the song on the guitar. You can produce each note in any available way. Dima understood that there are many ways to play a song and he wants to play it so as to make the song look as complicated as possible (try to act like Cobein). We'll represent a way to play a song as a sequence of pairs $ (x_{i},y_{i}) $ $ (1

Input Format

The first line of the input contains four integers $ n $ , $ m $ , $ k $ and $ s $ $ (1

Output Format

In a single line print a single number — the maximum possible complexity of the song.