#include <bits/stdc++.h>
using namespace std;
struct InputReader {
  char buf[1000001];
  int p;
  inline InputReader() { p = 1000001; }
  inline void Flush() {
    p = 0;
    fread(buf, 1, 1000001, stdin);
  }
  inline char C() {
    if (p >= 1000001) Flush();
    return buf[p++];
  }
  inline char Readnum() {
    char ch = C();
    while (!isdigit(ch) && ch != '-') ch = C();
    return ch;
  }
  inline void Readalpha(char &c) {
    c = C();
    while (!isalpha(c)) c = C();
  }
  int operator()() {
    int ans = 0, fu = 1;
    char ch = Readnum();
    if (ch == '-') fu = -1, ch = C();
    while (ch >= '0' && ch <= '9') {
      ans = ans * 10 + ch - '0';
      ch = C();
    }
    return ans * fu;
  }
  long long Readll() {
    long long ans = 0LL, fu = 1LL;
    char ch = Readnum();
    if (ch == '-') fu = -1LL, ch = C();
    while (ch >= '0' && ch <= '9') {
      ans = ans * 10LL + ch - '0';
      ch = C();
    }
    return ans * fu;
  }
  inline void Readstring(string &x) {
    x.clear();
    char ch = C();
    while (!isdigit(ch) && !isalpha(ch) && ch != '#' && ch != '.') ch = C();
    while (isdigit(ch) || isalpha(ch) || ch == '#' || ch == '.') {
      x += ch;
      ch = C();
    }
  }
  inline void Readchstring(char s[]) {
    int len = 0;
    char ch = C();
    while (!isdigit(ch) && !isalpha(ch)) ch = C();
    while (isdigit(ch) || isalpha(ch)) {
      s[len++] = ch;
      ch = C();
    }
    s[len] = '\0';
  }
  inline void Specialread(char &c) {
    c = C();
    while (!isdigit(c) && !isalpha(c) && c != '#' && c != '.' && c != '=' &&
           c != 'B')
      c = C();
  }
} In;
inline void Read(int &x) { x = In(); }
inline void Read(int &x, int &y) {
  x = In();
  y = In();
}
inline void Read(int &x1, int &x2, int &x3) {
  x1 = In();
  x2 = In();
  x3 = In();
}
inline void Read(int &x1, int &x2, int &x3, int &x4) {
  x1 = In();
  x2 = In();
  x3 = In();
  x4 = In();
}
inline void Read(long long &x) { x = In.Readll(); }
inline void Read(long long &x, long long &y) {
  x = In.Readll();
  y = In.Readll();
}
inline void Read(long long &x1, long long &x2, long long &x3) {
  x1 = In.Readll();
  x2 = In.Readll();
  x3 = In.Readll();
}
inline void Read(long long &x1, long long &x2, long long &x3, long long &x4) {
  x1 = In.Readll();
  x2 = In.Readll();
  x3 = In.Readll();
  x4 = In.Readll();
}
template <typename T>
inline void Read(T a[], int s, int t) {
  for (int(i) = (s); (i) <= (t); ++(i)) Read(a[i]);
}
inline void FILEIO() {}
inline void FILEIO(string pname) {
  freopen((pname + ".in").c_str(), "r", stdin);
  freopen((pname + ".out").c_str(), "w", stdout);
}
void Printtime() {}
void END() {
  Printtime();
  exit(0);
}
template <typename T>
void END(T mes) {
  cout << mes << endl;
  END();
}
template <typename T>
void Print(T a[], int s, int t, char sp = ' ', char ed = '\n') {
  if (s > t) return;
  for (int i = s; i < t; i++) cout << a[i] << sp;
  cout << a[t] << ed;
  cout.flush();
}
template <typename T>
void Print(T a, int s = 0, int t = -1, char sp = ' ', char ed = '\n') {
  if (t == -1) t = a.size() - 1;
  for (int i = s; i <= t; i++) cout << a[i] << sp;
  cout << ed;
  cout.flush();
}
long long Pow(long long a, long long b, long long p = (998244353LL)) {
  long long ret = 1;
  for (; b; a = a * a % p, b >>= 1LL)
    if (b & 1LL) ret = ret * a % p;
  return ret;
}
long long Inv(long long a, long long p = (998244353LL)) {
  return Pow(a, p - 2LL, p);
}
long long Fact(long long x) {
  long long ret = 1;
  for (int(i) = 1; (i) <= (x); ++(i)) ret = ret * i % (998244353LL);
  return ret;
}
int n;
long long a[300010];
long long x;
long long mem[300010][8];
long long Dfs(int pos, int b1, int b2) {
  if (pos == n + 1) return 0;
  if (~mem[pos][(b2 << 1) | b1]) return mem[pos][(b2 << 1) | b1];
  long long ans = 0;
  if (b1 == 0) {
    (ans) = max((ans), (Dfs(pos + 1, 0, 0)));
    (ans) = max((ans), (Dfs(pos + 1, 1, 0) + a[pos]));
    (ans) = max((ans), (Dfs(pos + 1, 1, 1) + a[pos] * x));
  } else if (b1 == 1) {
    if (b2 == 0) {
      (ans) = max((ans), (Dfs(pos + 1, 1, 0) + a[pos]));
      (ans) = max((ans), (Dfs(pos + 1, 1, 1) + a[pos] * x));
    } else if (b2 == 1) {
      (ans) = max((ans), (Dfs(pos + 1, 1, 2) + a[pos]));
      (ans) = max((ans), (Dfs(pos + 1, 1, 1) + a[pos] * x));
    } else {
      (ans) = max((ans), (Dfs(pos + 1, 1, 2) + a[pos]));
    }
  }
  return mem[pos][(b2 << 1) | b1] = ans;
}
int main() {
  FILEIO();
  memset(mem, -1, sizeof(mem));
  Read(n);
  Read(x);
  for (int(i) = 1; (i) <= (n); ++(i)) Read(a[i]);
  long long ans = Dfs(1, 0, 0);
  cout << ans << endl;
  END();
}

### Prompt

Your challenge is to write a CPP solution to the following problem:

You are given an array a consisting of n integers. Beauty of array is the maximum sum of some consecutive subarray of this array (this subarray may be empty). For example, the beauty of the array [10, -5, 10, -4, 1] is 15, and the beauty of the array [-3, -5, -1] is 0.

You may choose at most one consecutive subarray of a and multiply all values contained in this subarray by x. You want to maximize the beauty of array after applying at most one such operation.

Input

The first line contains two integers n and x (1 ≤ n ≤ 3 ⋅ 10^5, -100 ≤ x ≤ 100) — the length of array a and the integer x respectively.

The second line contains n integers a_1, a_2, ..., a_n (-10^9 ≤ a_i ≤ 10^9) — the array a.

Output

Print one integer — the maximum possible beauty of array a after multiplying all values belonging to some consecutive subarray x.

Examples

Input


5 -2
-3 8 -2 1 -6


Output


22


Input


12 -3
1 3 3 7 1 3 3 7 1 3 3 7


Output


42


Input


5 10
-1 -2 -3 -4 -5


Output


0

Note

In the first test case we need to multiply the subarray [-2, 1, -6], and the array becomes [-3, 8, 4, -2, 12] with beauty 22 ([-3, 8, 4, -2, 12]).

In the second test case we don't need to multiply any subarray at all.

In the third test case no matter which subarray we multiply, the beauty of array will be equal to 0.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
struct InputReader {
  char buf[1000001];
  int p;
  inline InputReader() { p = 1000001; }
  inline void Flush() {
    p = 0;
    fread(buf, 1, 1000001, stdin);
  }
  inline char C() {
    if (p >= 1000001) Flush();
    return buf[p++];
  }
  inline char Readnum() {
    char ch = C();
    while (!isdigit(ch) && ch != '-') ch = C();
    return ch;
  }
  inline void Readalpha(char &c) {
    c = C();
    while (!isalpha(c)) c = C();
  }
  int operator()() {
    int ans = 0, fu = 1;
    char ch = Readnum();
    if (ch == '-') fu = -1, ch = C();
    while (ch >= '0' && ch <= '9') {
      ans = ans * 10 + ch - '0';
      ch = C();
    }
    return ans * fu;
  }
  long long Readll() {
    long long ans = 0LL, fu = 1LL;
    char ch = Readnum();
    if (ch == '-') fu = -1LL, ch = C();
    while (ch >= '0' && ch <= '9') {
      ans = ans * 10LL + ch - '0';
      ch = C();
    }
    return ans * fu;
  }
  inline void Readstring(string &x) {
    x.clear();
    char ch = C();
    while (!isdigit(ch) && !isalpha(ch) && ch != '#' && ch != '.') ch = C();
    while (isdigit(ch) || isalpha(ch) || ch == '#' || ch == '.') {
      x += ch;
      ch = C();
    }
  }
  inline void Readchstring(char s[]) {
    int len = 0;
    char ch = C();
    while (!isdigit(ch) && !isalpha(ch)) ch = C();
    while (isdigit(ch) || isalpha(ch)) {
      s[len++] = ch;
      ch = C();
    }
    s[len] = '\0';
  }
  inline void Specialread(char &c) {
    c = C();
    while (!isdigit(c) && !isalpha(c) && c != '#' && c != '.' && c != '=' &&
           c != 'B')
      c = C();
  }
} In;
inline void Read(int &x) { x = In(); }
inline void Read(int &x, int &y) {
  x = In();
  y = In();
}
inline void Read(int &x1, int &x2, int &x3) {
  x1 = In();
  x2 = In();
  x3 = In();
}
inline void Read(int &x1, int &x2, int &x3, int &x4) {
  x1 = In();
  x2 = In();
  x3 = In();
  x4 = In();
}
inline void Read(long long &x) { x = In.Readll(); }
inline void Read(long long &x, long long &y) {
  x = In.Readll();
  y = In.Readll();
}
inline void Read(long long &x1, long long &x2, long long &x3) {
  x1 = In.Readll();
  x2 = In.Readll();
  x3 = In.Readll();
}
inline void Read(long long &x1, long long &x2, long long &x3, long long &x4) {
  x1 = In.Readll();
  x2 = In.Readll();
  x3 = In.Readll();
  x4 = In.Readll();
}
template <typename T>
inline void Read(T a[], int s, int t) {
  for (int(i) = (s); (i) <= (t); ++(i)) Read(a[i]);
}
inline void FILEIO() {}
inline void FILEIO(string pname) {
  freopen((pname + ".in").c_str(), "r", stdin);
  freopen((pname + ".out").c_str(), "w", stdout);
}
void Printtime() {}
void END() {
  Printtime();
  exit(0);
}
template <typename T>
void END(T mes) {
  cout << mes << endl;
  END();
}
template <typename T>
void Print(T a[], int s, int t, char sp = ' ', char ed = '\n') {
  if (s > t) return;
  for (int i = s; i < t; i++) cout << a[i] << sp;
  cout << a[t] << ed;
  cout.flush();
}
template <typename T>
void Print(T a, int s = 0, int t = -1, char sp = ' ', char ed = '\n') {
  if (t == -1) t = a.size() - 1;
  for (int i = s; i <= t; i++) cout << a[i] << sp;
  cout << ed;
  cout.flush();
}
long long Pow(long long a, long long b, long long p = (998244353LL)) {
  long long ret = 1;
  for (; b; a = a * a % p, b >>= 1LL)
    if (b & 1LL) ret = ret * a % p;
  return ret;
}
long long Inv(long long a, long long p = (998244353LL)) {
  return Pow(a, p - 2LL, p);
}
long long Fact(long long x) {
  long long ret = 1;
  for (int(i) = 1; (i) <= (x); ++(i)) ret = ret * i % (998244353LL);
  return ret;
}
int n;
long long a[300010];
long long x;
long long mem[300010][8];
long long Dfs(int pos, int b1, int b2) {
  if (pos == n + 1) return 0;
  if (~mem[pos][(b2 << 1) | b1]) return mem[pos][(b2 << 1) | b1];
  long long ans = 0;
  if (b1 == 0) {
    (ans) = max((ans), (Dfs(pos + 1, 0, 0)));
    (ans) = max((ans), (Dfs(pos + 1, 1, 0) + a[pos]));
    (ans) = max((ans), (Dfs(pos + 1, 1, 1) + a[pos] * x));
  } else if (b1 == 1) {
    if (b2 == 0) {
      (ans) = max((ans), (Dfs(pos + 1, 1, 0) + a[pos]));
      (ans) = max((ans), (Dfs(pos + 1, 1, 1) + a[pos] * x));
    } else if (b2 == 1) {
      (ans) = max((ans), (Dfs(pos + 1, 1, 2) + a[pos]));
      (ans) = max((ans), (Dfs(pos + 1, 1, 1) + a[pos] * x));
    } else {
      (ans) = max((ans), (Dfs(pos + 1, 1, 2) + a[pos]));
    }
  }
  return mem[pos][(b2 << 1) | b1] = ans;
}
int main() {
  FILEIO();
  memset(mem, -1, sizeof(mem));
  Read(n);
  Read(x);
  for (int(i) = 1; (i) <= (n); ++(i)) Read(a[i]);
  long long ans = Dfs(1, 0, 0);
  cout << ans << endl;
  END();
}

```