Performing complex calculations and outputting result