# coding utf-8 def Input_func(): data = input().split(" ") return data def Time_count_func(time, a, b, c, d): section_time = 0 for t in range(time): if t % (a + b) < a and t % (c + d) < c: section_time += 1 return section_time def Calc_func(data): a = int(data[0]) b = int(data[1]) c = int(data[2]) d = int(data[3]) e = int(data[4]) section_time = 0 cycle_num = 0 dive_rem = 0 answer = 0 # cycle time time = ((a + b) * (d + c)) # e < cycle time if e < time: time = e answer = Time_count_func(time, a, b, c, d) else: cycle_num = e // time dive_rem = e % time section_time = Time_count_func(time, a, b, c, d) if answer != 0: print(answer) else: answer = section_time * cycle_num answer += Time_count_func(dive_rem, a, b, c, d) print(answer) def main(): # data[0]~[4] is A~E data = Input_func() Calc_func(data) if __name__ == '__main__': main()