local a, b = io.read("*n", "*n") local c, d = io.read("*n", "*n") local e = io.read("*n") local z1, z2 = 0, 0 local day = 0 local sz = 0 local ret = 0 while true do z1, z2 = z1 + 1, z2 + 1 if a + b < z1 then z1 = 1 end if c + d < z2 then z2 = 1 end day = day + 1 if z1 <= a and z2 <= c then ret = ret + 1 end if e == day then print(ret) os.exit() end if day ~= 1 and z1 == 1 and z2 == 1 then sz = day - 1 ret = ret - 1 break end end ret = ret * math.floor(e / sz) local e = e % sz day = 0 z1, z2 = 0, 0 while day < e do day = day + 1 z1, z2 = z1 + 1, z2 + 1 if a + b < z1 then z1 = 1 end if c + d < z2 then z2 = 1 end if z1 <= a and z2 <= c then ret = ret + 1 end if e == day then break end end print(ret)