// кстати, а откуда задачки?
#include <iostream>
#include <string>
using namespace std;
int counter = 0;
int answer(string s, int l, int n, int length) {
for (char ch = '0'; ch < length + '0'; ++ch) {
if (ch == '0' && l && s[l - 1] == '0')
continue;
if (l + 1 < n)
answer(s + ch, l + 1, n, length);
else
++counter;
}
return counter;
}
int main() {
int n, length;
cin >> n >> length;
cout << answer("", 0, n, length);
}
#include <iostream>
#include <vector>
using namespace std;
int main() {
vector<int> ladder;
int size, sum = 0;
cin >> size;
ladder.resize(size);
for (int i = 0; i < size; ++i) {
cin >> ladder[i];
}
for (int i = 0; i < size; ++i) {
if (i + 1 < size && ladder[i] < 0) { // ladder[i] + ladder[i+1] < ladder[i + 1]
sum += ladder[i + 1];
++i;
}
else {
sum += ladder[i];
}
}
cout << sum;
}