Python: Calculating with dictionaries.