Yo`nalishlar
Hozirda online

Statistika

Masalalar soni: 909

Foydalanuvchilar soni: 8819

Jo'natishlar soni: 714314

Muhokama yozuvlari: 4540

Yangiliklar soni: 97

Yangiliklar izohlari: 1174


So'ngi izohlar

786. Hamming Problem
Vaqt limiti: 1 sekund
Xotira limiti: 64 MB

For each three prime numbers p1, p2 and p3, let’s define Hamming sequence Hi(p1, p2, p3), i=1,…  as containing in increasing order all the natural numbers whose only prime divisors are p1, p2 or p3.

For example, H(2, 3, 5) = 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, 16, 18, 20, 24, 25, 27,...

So H5(2, 3, 5)=6.

Input

In the single line of input file there are space-separated integers p1 p2 p3 i.

p1, p2 and p3 are different prime numbers.

Output

 The output file must contain the single integer — Hi(p1, p2, p3). All numbers in input and output are less than 1018.

Input

Output

1

7 13 19 100

26590291

 

Tayyorladi: Azat Yusupov
Text from: FarEastern subregional
Mening urinishlarim(0) Muhokama (0) Jo'natish Eng yaxshi yechimlar Barcha muvaffaqiyatli urinishlar(26) Barcha urinishlar(51)