#include <bits/stdc++.h>
using namespace std;
const long long INF = 1LL << 60; // 十分大きな値に
typedef long long ll;
typedef long double ld;

int main() {
    ll N, K;
    cin >> N >> K;

    for (ll i=0; i<K; i++) {
        if (N%200==0) {
            N /= 200;
        }
        else {
            N *= 1000;
            N += 200;
        }
    }
    cout << N << endl;
}
#include "bits/stdc++.h"
using namespace std;

// 定義
typedef long long         ll;
typedef pair<ll, ll>      P;
#define ALL(x)            (x).begin(),(x).end()
#define REP(i, n)         for(ll i = 0 ; i < (ll)n ; ++i)
#define REPN(i, m, n)     for(ll i = m ; i < (ll)n ; ++i)
#define VL                vector<ll>
#define VVL               vector<vector<ll>>
#define VVVL              vector<vector<vector<ll>>>
#define INF               (ll)2e9
#define INF_LL            1LL<<60
//#define MOD             998244353
#define MOD               1000000007

ll Ceil(ll val, ll div)   { return (val + div - 1) / div; }
ll CeilN(ll val, ll div)  { return Ceil(val, div) * div; }
ll FloorN(ll x, ll n)     { return (x - x % n); }
bool IsOdd(ll x)          { return ((x & 1) == 1); }
bool IsEven(ll x)         { return ((x & 1) == 0); }

void Solve()
{
	ll N;
	cin >> N;

	ll cnt = 0;
	vector<P> two;
	ll multi = 1;
	while (multi <= N) {
		two.emplace_back(cnt, multi);
		multi *= 2;
		cnt++;
	}

	VL ans;
	for (auto t : two) {
		ll b = N / t.second;
		ll a = t.first;
		ll c = N % t.second;
		ll ansOne = a + b + c;
		ans.emplace_back(ansOne);
	}

	sort(ALL(ans));
	cout << ans.front() << endl;
}

// メイン
int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Solve();
	return 0;
}
