# this is a simple probabilistic program without loops. # 3, 5, and 7 resource units are consumed with the same probability 1/3. # Thus the expected resource usage is 1/3*3 + 1/3*5 + 1/3*7 = 5 def f(): var flag, z prob(1,2): flag = 0 tick 3 else: prob(1,1): flag = 1 tick 5 else: flag = 1 tick 7