[C++] easy solution
\nclass Solution {\npublic:\n    int kadane(vector<int>&arr){\n        int maxsum=arr[0];\n        int currsum=arr[0];\n        for(int i=1;i<arr.size();i++){\n
```\nclass Solution {\npublic:\n    int kadane(vector<int>&arr){\n        int maxsum=arr[0];\n        int currsum=arr[0];\n        for(int i=1;i<arr.size();i++){\n            currsum=max(currsum+arr[i],arr[i]);\n            maxsum=max(maxsum,currsum);\n        }\n        return maxsum%1000000007;\n    }\n    int kadaneoftwo(vector<int>&arr){\n        vector<int>arrx(arr.size()*2,0);\n        for(int i=0;i<arr.size();i++){\n            arrx.push_back(arr[i]);\n        }        \n        for(int i=0;i<arr.size();i++){\n            arrx.push_back(arr[i]);\n        }   \n        int maxsum=kadane(arrx);\n        return maxsum%1000000007;\n    }\n    \n    int kConcatenationMaxSum(vector<int>& arr, int k) {\n        if(arr.size()==0)\n            return 0;\n        long long sum=accumulate(arr.begin(),arr.end(),0)%1000000007;\n        if(k==1)\n            return kadane(arr);\n        if(sum%1000000007<0)\n            return kadaneoftwo(arr);\n        if(sum%1000000007>=0)\n            return kadaneoftwo(arr)+(((k-2)*sum)%1000000007)%1000000007;\n        return 0;\n    }\n};\n```
['C', 'C++']