
class MovingAverage(object):
	def __init__(self, max):
		self.queue = []
		self.max = max

	def dequeue(self):
		length = len(self.queue)
		if length == 0 or length < self.max:
			return -1
		return self.queue.pop(0)

	def enqueue(self, n):
		length = len(self.queue)
		if length == self.max:
			self.dequeue()

		self.queue.append(n)
		pass

	def sum(self):
		sum = 0
		for item in self.queue:
			sum += item
		return sum

	def avg(self):
		length = len(self.queue)
		total = self.sum()
		return round(total / length, 2)

	def print(self):
		print(self.sum(), self.queue)