#include <bits/stdc++.h>
#define vodka void
#define ll long long
#define pf push_front
#define f first
#define s second
#define pb push_back
#define eb emplace_back
#define ub upper_bound
#define lb lower_bound
#define ld long double
#define np next_permutation
#define us unordered_set
#define um unordered_map
#define cont continue
#define pq priority_queue
#define No cout << "No" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define YES cout << "YES" << endl
#define yes cout << "yes" << endl;
#define no cout << "no" << endl;
#define endl "\n"
#define me *max_element
#define mie *min_element
#define acc accumulate
#define ull unsigned long long
#define all(x) x.begin(), x.end()
#define all1(x) x.begin() + 1, x.end()
#define allr1(x) x.rbegin() + 1, x.rend()
#define allr(x) x.rbegin(),x.rend()
#define raha_gay_lord ios_base::sync_with_stdio(0),cin.tie(0), cout.tie(0)
#pragma GCC optimize("O3")
//#pragma comment(linker, "/stack:200000000")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native,avx2")
#pragma GCC optimize("unroll-loops")
using namespace std;
ll rch = 0, sch = 0;
const ll MOD = 1e9 + 7;
const ll GIGAMOD = 998244353;
const ll MAXN = 1e5 + 10;
const ll LOG = 16;
const ll GIGA_LOG = 20;
//bool was[MAXN];
const ll Inf = 1e18 + 5;
const ll N = 1e6 + 5;
const ll tree = N * 4;
ll binpow(ll x, ll p, ll mod){
if (!p) return 1;
if (p % 2) return (x % mod * binpow(x, p - 1, mod)) % mod;
ll xx = binpow(x, p / 2, mod);
return (xx % mod * xx % mod) % mod;
}
ll Xor_function(ll n){
if (n % 4 == 0) return n;
else if (n % 4 == 1) return 1;
else if (n % 4 == 2) return n + 1;
else return 0;
}
ll modinv(ll a, ll mod){
ll res = 1, pw = mod - 2;
while (pw){
if (pw & 1) res = (res * a) % mod;
a = (a * a) % mod;
pw /= 2;
}
return res;
}
/*const ll fact[N];
ll C(ll k, ll n){
ll x = fact[n];
x = x * modinv(fact[k], MOD) % MOD;
x = x * modinv(fact[n - k], MOD) % MOD;
return x;
}
ll A(ll k, ll n){
ll x = fact[n];
x = x * modinv(fact[n - k], MOD) % MOD;
return x;
}
*/
ll lcm(ll a, ll b) {
return abs(a * b) / __gcd(a, b);
}
ll get_sum(ll x){
return (x * (x + 1) / 2);
}
bool triangle(ll a, ll b, ll c){
return (a + b > c && a + c > b && b + c > a);
}
bool check_pow_two(ll n){
return ((n & (n + 1)) == 0);
}
bool cmp(pair<ll, ll>& a, pair<ll, ll>& b){
if (a.s != b.s) return a.s < b.s;
return a.f < b.f;
}
pair<ll, ll> dir[4] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
bool check(ll x, ll y, ll n, ll m){
return (x >= 1 && x <= n && y >= 1 && y <= m);
}
//template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update
vodka solve(){
ll x, n;
cin >> x >> n;
ll ans = x;
for (ll i = 0; i < n; ++i){
ll p;
cin >> p;
if (i == 0) ans = (x - p);
else {
ans += (x - p);
}
}
cout << ans + x << endl;
}
int main(){
raha_gay_lord;
ll ttttt = 1;
//cin >> ttttt;
//ll cnt = 1;
while (ttttt--){
//cout << "Case " << cnt << ": ";
solve();
//cnt++;
}
#ifndef ONLINE_JUDGE
cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |