L=list(map(int,__import__("sys").stdin.read().split(",")))
for i in range(min(L), max(L)+1):
R=sum(abs(l-i) for l in L)
print(R,i)
# python3 d07_2.py < input | sort -n | head -1