#B3822. Calculate GDP Using Expenditure Method
Calculate GDP Using Expenditure Method
Calculate GDP Using Expenditure Method
GDP, or Gross Domestic Product, is a key indicator for measuring a region's economic development. One common method of calculating GDP is the expenditure approach, which sums up the total purchases of final goods and services in the economy. The typical categories of final goods and services are: Consumption (\( C \)), Investment (\( I \)), Government Spending (\( G \)), and Net Exports (\( \mathrm{NX} \)). Net Exports is defined as the difference between the total exports \( X \) and imports \( M \), i.e. \( \mathrm{NX} = X - M \).
Given the values for consumption, investment, government spending, imports, and exports, your task is to calculate the GDP using the formula:
\( GDP = C + I + G + (X - M) \)
inputFormat
The input consists of a single line containing five numbers: the amounts for consumption, investment, government spending, imports, and exports, in that order. The numbers can be assumed to be non-negative.
outputFormat
Output the calculated GDP as a single number.
sample
100 50 30 20 40
200