C++
\nusing LL = long long;\nclass Solution {\n    LL dp[100005][2];\npublic:\n    long long maximumTotalCost(vector<int>& nums) {\n        dp[0][0] = nums[0];\n   
```\nusing LL = long long;\nclass Solution {\n    LL dp[100005][2];\npublic:\n    long long maximumTotalCost(vector<int>& nums) {\n        dp[0][0] = nums[0];\n        dp[0][1] = LLONG_MIN/2;\n        int n = nums.size();\n        for(int i = 1; i < n; i++){\n            dp[i][0] = max(dp[i-1][0], dp[i-1][1]) + nums[i];\n            dp[i][1] = dp[i-1][0] - nums[i];\n        }\n        return max(dp[n-1][0], dp[n-1][1]);\n    }\n};\n```
[]