Using one Kadane's Algo function only || C++
\nclass Solution {\npublic:\n    \n    int kadane(vector<int>& a){\n        \n        int ans = 0;\n        \n        int curr = 0;\n        \n        for(auto 
```\nclass Solution {\npublic:\n    \n    int kadane(vector<int>& a){\n        \n        int ans = 0;\n        \n        int curr = 0;\n        \n        for(auto i:a){\n            \n            curr += i;\n            \n            if(curr<0)\n                curr = 0;\n            \n            ans = max(ans,curr);\n        }\n        \n        return ans;\n    }\n    \n    int kConcatenationMaxSum(vector<int>& a, int k) {\n        \n        long sum = accumulate(a.begin(),a.end(),0);\n        \n        long ans = 0;\n        \n        int n = a.size();\n        \n        if(k == 1){\n            \n            ans = kadane(a) % 1000000007;\n        \n        }else{\n            \n            vector<int> b(n*2);\n            \n            for(int i = 0 ; i < b.size() ; i++)\n                b[i] = a[i%n];\n            \n            ans = kadane(b)%1000000007;\n            \n            if(sum >= 0)\n                 ans=(ans + (k-2)*sum)%1000000007;\n            \n        }\n        \n        if(ans<0)return 0;\n        \n        return ans;\n    }\n};\n```
[]