calculates amount