c++ | short sol. | easy
```\n long total = 0;\n        for(auto next : arr) total += next;\n        \n        long onepass = kadane(arr);\n        long circular = circ(arr);\n        l
```\n long total = 0;\n        for(auto next : arr) total += next;\n        \n        long onepass = kadane(arr);\n        long circular = circ(arr);\n        long startmax = start(arr);\n        long endmax = end(arr);\n        if(k == 1) return onepass;\n        return max<long int>(max(onepass, circular), startmax + endmax + (k-2) * total) % 1000000007;\n    }\n    \n    \nprivate:\n    long circ(vector<int>  arr) {\n        int total = 0;\n        for(auto & next : arr)  {\n            next = -1 * next;\n            total += next;\n        }\n        int temp = kadane(arr);\n        return -1 * (total - minarray(arr));\n        \n    }\n    \n    long minarray(vector<int> arr) {\n        int temp = kadane(arr);\n        return temp;\n        \n    }\n    long kadane(vector<int> & arr) {\n        int sumsf = 0;\n        int res = 0;\n        for(int i = 0 ; i < arr.size() ;i++) {\n            sumsf += arr[i];\n            sumsf = max(sumsf, 0);\n            res = max(res, sumsf);\n        }\n        return res;\n    }\n    \n    long start(vector<int> & arr) {\n        int sumsf = 0;\n        int res = 0;\n        for(auto next : arr) {\n            sumsf += next;\n            res = max(res, sumsf);\n        }\n        return res;\n            \n    }\n    \n    long end(vector<int> & arr) {\n        int sumsf = 0;\n        int res = 0;\n        for(int i = arr.size() -1 ; i >= 0 ; i--) {\n            sumsf += arr[i];\n            res = max(res, sumsf);\n        }\n        return res;\n    }\n};
[]