class MovingAverage(object):



    def __init__(self, size):

        # Initialize your data structure here.

        self.size = size

        self.sum = 0.0

        self.array = []

        self.counter = 0







    # @param {int} val an teger

    def next(self, val):

        # Write your code here

        self.counter+= 1

        self.sum+= val

        self.array.append(self.sum)

        if self.counter<= self.size:

            return self.sum/self.counter

        else:

            return (self.sum- self.array[self.counter- self.size- 1])/self.size

            


