/*
TASK:sqrt
LANG:C++
*/
#include <iostream>
#include <cmath>
using namespace std;
typedef long double LD;

string R;
int K;
int N,m;

bool cmp(string a, string b)
{
     if(a.length()>b.length()) return 1;
     if(b.length()>a.length()) return 0;
     return a>b;
}

string cl(string a)
{
       while(a[0]=='0')
       {
                       a = a.substr(1);
       }
       return a;
}

string rev(string a)
{
       string t;
       int n = a.length();
       for(int i=0; i<n; i++)
       {
               t+=a[n-i-1];
       }
       return t;
}

string sum(string a, string b)
{
       string res;
       int N = max(a.length(), b.length()) + 1;
       int n1 = a.length(), n2 = b.length();
       a = rev(a);
       b = rev(b);
       a.resize(N);
       b.resize(N);
       for(int k = n1; k<N; k++)
       {
               a[k] = '0';
       }
       for(int h = n2; h<N; h++)
       {
               b[h] = '0';
       }
       int ost = 0;
       res.resize(N);
       for(int g = 0; g<N; g++)
       {
               int tem = a[g]+b[g]+ost-2*'0';
               res[g] = tem%10 + '0';
               ost = tem/10;
       }
       res = rev(res);
       res = cl(res);
       return res;
}

string pt(string a, int t)
{
       for(int g=0; g<t; g++)
       {
               a+='0';
       }
       return a;
}

string mulc(string a, char c)
{
       a = rev(a);
       int N = a.length()+1;
       a.resize(N);
       a[N-1] = '0';
       string res;
       res.resize(N);
       int ost = 0;
       for(int i=0; i<N; i++)
       {
               int tm = (a[i]-'0')*c + ost;
               res[i] = tm%10 + '0';
               ost = tm/10;
       }
       res = rev(res);
       return res;
}

string mul(string a, string b)
{
       string sm;
       for(int i=0; i<a.length(); i++)
       {
               sm = sum(sm, pt(mulc(b, a[i]-'0'), a.length()-i-1));
       }
       return cl(sm);
}

string mid(string a, string b)
{
       string sm = sum(a, b);
       int ost = 0;
       for(int i=0; i<sm.length(); i++)
       {
               int iz = (sm[i] - '0' + ost*10);
               ost = iz%2;
               sm[i] = iz/2 + '0';
       }
       return cl(sm);
}

string dif(string a, string b)
{
       if(!cmp(a,b)) {swap(a, b);}
       int N = a.length();
       a = rev(a);
       b = rev(b);
       string res;
       res.resize(N);
       int ost = 0;
       for(int i=0; i<N; i++)
       {
               res[i] = (a[i]-b[i]+10-ost)%10 + '0';
               ost = (a[i]-b[i]-ost)<0;
       }
       return cl(rev(res));
}

string findn(string a, string b)
{
    string G = mid(a,b);
    //cout<<G<<" "<<mul(G, G)<<" "<<R<<endl;
    if(G==a)
    {
            //string G1 = sum(G, string("1"));
            //cout<<dif(mul(G, G), R)<<" "<<dif(mul(G1, G1), R)<<endl;
            //return (cmp(dif(mul(G, G), R),dif(mul(G1, G1), R)))?G1:G;
            return G;
    }
    else
    {
        return (cmp(mul(G, G),R))?findn(a, G):findn(G, b);
    }
}

int main()
{
    cin>>N>>K;
    m = int(floor(log10(int(floor(sqrt(N)))))) + 1;
    //cout<<m<<endl;
    while(N)
    {
            R+=(N%10+'0');
            N/=10;
    }
    R = rev(R);
    R = pt(R, 2*K);
    //cout<<R<<endl;
    string res = findn(string("0"), R.substr(0, R.length() - K));
    for(int g=0; g<m; g++)
    {
            cout<<res[g];
    }
    cout<<",";
    for(int h=m; h<K+m; h++)
    {
            cout<<res[h];
    }
    cout<<endl;
    return 0;
}
