Balaji,
The calculation by the system is correct according to the data it is being provided.
Cost of 1 = Cost of Header - Cost of byproducts + Cost of processing = 1000 - (200+200) +200 = 800.
My initial thoughts will be this is not the right approach for the business scenario you have described. I will try and get back to you with a possible solution.