#include <algorithm>
#include <bitset>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string>
#include <string.h>
#include <vector>

using namespace std;

#define ALL(a)  (a).begin(),(a).end()
#define REP(i, n) for(int i=0; i<(int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i < (int)(e); i++)
#define EACH(itr,c) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define ABS(x) ((x) < 0 ? - (x) : (x))
#define SIZE(buff) (sizeof(buff)/sizeof(buff[0]))
#define SORT(c) sort((c).begin(),(c).end())
#define MP make_pair
#define INF 999999999
#define DISP(x) cout << #x << " : " << x << endl

typedef long long int LL;

const double pi = acos(-1.0);

string transform(string x, int n) {
    for (int i = 0; i < n-1 ; i++) {
        if (x[i] == '4' && x[i+1] == '7') {
            if ((i+1) % 2)
                x[i] = x[i+1] = '4';
            else
                x[i] = x[i+1] = '7';
            break;
        }
    }

    return x;
}

int main() {
    int n, k;

    cin >> n >> k;
    string s;

    map<string, int> used;
    cin >> s;
    used[s] = 0;

    int p = 0;
    int q = 0;
    for (int i = 0; i < k; i++) {
        s = transform(s, n);
        if (used.count(s)) {
            p = (i+1) - used[s];
            q = k - (i+1);
            break;
        }
        else
            used[s] = i+1;
    }

    p = (q > 0) ? p % q : 0;
    for (int i = 0; i < p; i++)
        s = transform(s, n);

    cout << s << endl;

    return 0;
}


#include <algorithm>
#include <bitset>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string>
#include <string.h>
#include <vector>

using namespace std;

#define ALL(a)  (a).begin(),(a).end()
#define REP(i, n) for(int i=0; i<(int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i < (int)(e); i++)
#define EACH(itr,c) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define ABS(x) ((x) < 0 ? - (x) : (x))
#define SIZE(buff) (sizeof(buff)/sizeof(buff[0]))
#define SORT(c) sort((c).begin(),(c).end())
#define MP make_pair
#define INF 999999999
#define DISP(x) cout << #x << " : " << x << endl

typedef long long int LL;

const double pi = acos(-1.0);

string transform(string x, int n) {
    for (int i = 0; i < n-1 ; i++) {
        if (x[i] == '4' && x[i+1] == '7') {
            if ((i+1) % 2)
                x[i] = x[i+1] = '4';
            else
                x[i] = x[i+1] = '7';
            break;
        }
    }

    return x;
}

int main() {
    int n, k;

    cin >> n >> k;
    string s;

    map<string, int> used;
    cin >> s;
    used[s] = 0;

    int p = 0;
    int q = 0;
    for (int i = 0; i < k; i++) {
        s = transform(s, n);
        if (used.count(s)) {
            p = (i+1) - used[s];
            q = k - (i+1);
            break;
        }
        else
            used[s] = i+1;
    }
    q = (p > 0) ? q % p : 0;
    for (int i = 0; i < q; i++)
        s = transform(s, n);

    cout << s << endl;

    return 0;
}


#include <algorithm>
#include <bitset>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string>
#include <string.h>
#include <vector>

using namespace std;

#define ALL(a)  (a).begin(),(a).end()
#define REP(i, n) for(int i=0; i<(int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i < (int)(e); i++)
#define EACH(itr,c) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define ABS(x) ((x) < 0 ? - (x) : (x))
#define SIZE(buff) (sizeof(buff)/sizeof(buff[0]))
#define SORT(c) sort((c).begin(),(c).end())
#define MP make_pair
#define INF 999999999
#define DISP(x) cout << #x << " : " << x << endl

typedef long long int LL;

const double pi = acos(-1.0);

int main() {
    int n, k;
    string s;

    cin >> n >> k;
    cin >> s;
    int i = 0;

    for (; k > 0; k--) {
        bool update = false;

        if (i+2 < n && i % 2 == 0) {
            if (s[i] == '4' && (s[i+1] == '4' || s[i+1] == '7') && s[i+2] == '7') {
                if (k % 2)
                    s[i+1] = '4' - s[i] + '7';
                break;
            }
        }

        for (int j = i; j < n - 1; j++) {
            if (s[j] == '4' && s[j+1] == '7') {
                if (j % 2 == 0) {
                    s[j] = s[j+1] = '4';
                    i = j;
                }
                else {
                    s[j] = s[j+1] = '7';
                    i = max(0, j-1);
                }
                update = true;
                break;
            }
        }

        if (!update)
            break;
    }

    cout << s << endl;
    return 0;
}


#include <algorithm>
#include <bitset>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string>
#include <string.h>
#include <vector>

using namespace std;

#define ALL(a)  (a).begin(),(a).end()
#define REP(i, n) for(int i=0; i<(int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i < (int)(e); i++)
#define EACH(itr,c) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define ABS(x) ((x) < 0 ? - (x) : (x))
#define SIZE(buff) (sizeof(buff)/sizeof(buff[0]))
#define SORT(c) sort((c).begin(),(c).end())
#define MP make_pair
#define INF 999999999
#define DISP(x) cout << #x << " : " << x << endl

typedef long long int LL;

const double pi = acos(-1.0);

int main() {
    int n, k;
    string s;

    cin >> n >> k;
    cin >> s;
    int i = 0;

    for (; k > 0; k--) {
        bool update = false;

        if (i+2 < n && i % 2 == 0) {
            if (s[i] == '4' && (s[i+1] == '4' || s[i+1] == '7') && s[i+2] == '7') {
                if (k % 2)
                    s[i+1] = '4' - s[i] + '7';
                break;
            }
        }

        for (int j = i; j < n - 1; j++) {
            if (s[j] == '4' && s[j+1] == '7') {
                if (j % 2 == 0) {
                    s[j] = s[j+1] = '4';
                    i = j;
                }
                else {
                    s[j] = s[j+1] = '7';
                    i = max(0, j-2);
                }
                update = true;
                break;
            }
        }

        if (!update)
            break;
    }

    cout << s << endl;
    return 0;
}


#include <algorithm>
#include <bitset>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string>
#include <string.h>
#include <vector>

using namespace std;

#define ALL(a)  (a).begin(),(a).end()
#define REP(i, n) for(int i=0; i<(int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i < (int)(e); i++)
#define EACH(itr,c) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define ABS(x) ((x) < 0 ? - (x) : (x))
#define SIZE(buff) (sizeof(buff)/sizeof(buff[0]))
#define SORT(c) sort((c).begin(),(c).end())
#define MP make_pair
#define INF 999999999
#define DISP(x) cout << #x << " : " << x << endl

typedef long long int LL;

const double pi = acos(-1.0);

string transform(string x, int n) {
    for (int i = 0; i < n-1 ; i++) {
        if (x[i] == '4' && x[i+1] == '7') {
            if ((i+1) % 2)
                x[i] = x[i+1] = '4';
            else
                x[i] = x[i+1] = '7';
            break;
        }
    }

    return x;
}

LL hash1(string x, int n) {
    LL ret = 0;

    for (int i = 0; i < n; i++)
        ret = 13 * ret + (x[i] - '0');

    return ret;
}

LL hash2(string x, int n) {
    LL ret = 0;

    for (int i = 0; i < n; i++)
        ret = 31 * ret + (x[i] - '0');

    return ret;
}

pair<LL, LL> encode(string x, int n) {
    pair<LL, LL> ret;
    ret.first = hash1(x, n);
    ret.second = hash2(x, n);

    return ret;
}

int main() {
    int n, k;

    cin >> n >> k;
    string s;

    map<pair<LL, LL>, int> used;
    cin >> s;
    used[encode(s, n)] = 0;

    int p = 0;
    int q = 0;
    for (int i = 0; i < k; i++) {
        s = transform(s, n);

        pair<LL, LL> code = encode(s, n);
        if (used.count(code)) {
            p = (i+1) - used[code];
            q = k - (i+1);
            break;
        }
        else
            used[code] = i+1;
    }
    q = (p > 0) ? q % p : 0;
    for (int i = 0; i < q; i++)
        s = transform(s, n);

    cout << s << endl;

    return 0;
}


#include <algorithm>
#include <bitset>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string>
#include <string.h>
#include <vector>

using namespace std;

#define ALL(a)  (a).begin(),(a).end()
#define REP(i, n) for(int i=0; i<(int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i < (int)(e); i++)
#define EACH(itr,c) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define MAX(a,b) ((a) > (b) ? (a) : (b))
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define ABS(x) ((x) < 0 ? - (x) : (x))
#define SIZE(buff) (sizeof(buff)/sizeof(buff[0]))
#define SORT(c) sort((c).begin(),(c).end())
#define MP make_pair
#define INF 999999999
#define DISP(x) cout << #x << " : " << x << endl

typedef long long int LL;

const double pi = acos(-1.0);

int idx;

string transform(string x, int n) {

    for (int i = max(0, idx-1); i < n-1 ; i++) {
        if (x[i] == '4' && x[i+1] == '7') {
            idx = i;
            if ((i+1) % 2)
                x[i] = x[i+1] = '4';
            else
                x[i] = x[i+1] = '7';
            break;
        }
    }

    return x;
}

LL hash1(string x, int n) {
    LL ret = 0;

    for (int i = 0; i < n; i++)
        ret = 13 * ret + (x[i] - '0');

    return ret;
}

LL hash2(string x, int n) {
    LL ret = 0;

    for (int i = 0; i < n; i++)
        ret = 31 * ret + (x[i] - '0');

    return ret;
}

pair<LL, LL> encode(string x, int n) {
    pair<LL, LL> ret;
    ret.first = hash1(x, n);
    ret.second = hash2(x, n);

    return ret;
}

int main() {
    int n, k;

    cin >> n >> k;
    string s;

    map<pair<LL, LL>, int> used;
    cin >> s;
    used[encode(s, n)] = 0;

    int p = 0;
    int q = 0;
    idx = 0;
    for (int i = 0; i < k; i++) {
        s = transform(s, n);

        pair<LL, LL> code = encode(s, n);
        if (used.count(code)) {
            p = (i+1) - used[code];
            q = k - (i+1);
            break;
        }
        else
            used[code] = i+1;
    }
    q = (p > 0) ? q % p : 0;
    for (int i = 0; i < q; i++)
        s = transform(s, n);

    cout << s << endl;

    return 0;
}


#include <cstdio>
#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>

#define fi first
#define se second
#define H return 0;

using namespace std;

template <class T> inline T abs ( T a ){return a>0? a : -a;}
typedef pair<int,int> ii;
typedef long long Lint;

int N,K;
string s;
int last;

int find(){

	for(int i=max(last-5,0);i<N-1;i++)
		if(s[i]=='4' && s[i+1]=='7')
			return last = i , i ;
	return -1;

}

int main(){

#ifndef ONLINE_JUDGE

	freopen("f.in","r",stdin);
	freopen("f.out","w",stdout);

#endif

	cin >> N >> K ;

	cin >> s ;

	//~ cin >> s ;

	while( K-- ){

		int c = find();
		//~ printf("c:%d\n",c);
		if(c==-1) break;

		if(c<N-2 && c%2==0 && s[c]=='4' && s[c+1]=='7' && s[c+2]=='7'){
			if(K%2==0)	s[c+1] = '4';
			break;
		}

		if(c % 2 ==1){
			s[c] = '7';
			s[c+1] = '7' ;
		}else{
			s[c] = '4';
			s[c+1] = '4' ;
		}

	}

	printf("%s\n",s.c_str());

	return 0;

}


#include <cstdio>
#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>

#define fi first
#define se second

using namespace std;

template <class T> T abs ( T a ){return a>0? a : -a;}
typedef pair<int,int> ii;
typedef long long Lint;

const int MAXN = 105;
const int MAXK = 55;
const int inf = 1e9;

int N,K;
string s;
int last;

int find(){

	for(int i=max(last-5,0);i<N-1;i++)
		if(s[i]=='4' && s[i+1]=='7')
			return last = i , i ;
	return -1;

}

int main(){

#ifndef ONLINE_JUDGE

	freopen("f.in","r",stdin);
	freopen("f.out","w",stdout);

#endif

	cin >> N >> K ;

	scanf(" %s",s.c_str());

	while( K-- ){

		int c = find();
		//~ printf("find:%d\n",c);
		if(c==-1) break;

		if(c%2==0 && s[c]=='4' && s[c+1]=='7' && s[c+2]=='7'){
			//~ puts("CYC");
			//~ printf("c:%d K:%d\n",c,K);
			if(K%2==0)	s[c+1] = '4' ;
			break;
		}

		if(c % 2 ==1){
			//~ puts("AAA");
			s[c] = '7';
			s[c+1] = '7' ;
		}else{
			//~ puts("BBB");
			s[c] = '4';
			s[c+1] = '4' ;
		}

		//~ printf("K :%d ==> %s\n",K,s.c_str());

	}

	printf("%s\n",s.c_str());

	return 0;

}


#include <cstdio>
#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>

#define fi first
#define se second

using namespace std;

template <class T> T abs ( T a ){return a>0? a : -a;}
typedef pair<int,int> ii;
typedef long long Lint;

const int MAXN = 105;
const int MAXK = 55;
const int inf = 1e9;

int N,K;
string s;
int last;

int find(){

	for(int i=max(last-5,0);i<N;i++)
		if(s[i]=='4' && s[i+1]=='7')
			return last = i , i ;
	return -1;

}

int main(){

#ifndef ONLINE_JUDGE

	freopen("f.in","r",stdin);
	freopen("f.out","w",stdout);

#endif

	cin >> N >> K ;

	scanf(" %s",s.c_str());

	while( K-- ){

		int c = find();
		//~ printf("find:%d\n",c);
		if(c==-1) break;

		if(c%2==0 && s[c]=='4' && s[c+1]=='7' && s[c+2]=='7'){
			//~ puts("CYC");
			//~ printf("c:%d K:%d\n",c,K);
			if(K%2==0)	s[c+1] = '4' ;
			break;
		}

		if(c % 2 ==1){
			//~ puts("AAA");
			s[c] = '7';
			s[c+1] = '7' ;
		}else{
			//~ puts("BBB");
			s[c] = '4';
			s[c+1] = '4' ;
		}

		//~ printf("K :%d ==> %s\n",K,s.c_str());

	}

	printf("%s\n",s.c_str());

	return 0;

}


#include <cstdio>
#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>

#define fi first
#define se second

using namespace std;

template <class T> T abs ( T a ){return a>0? a : -a;}
typedef pair<int,int> ii;
typedef long long Lint;

const int MAXN = 105;
const int MAXK = 55;
const int inf = 1e9;

int N,K;
string s;

int find(){

	static int last = 0 ;

	for(int i=max(last-1,0);i<N;i++)
		if(s[i]=='4' && s[i+1]=='7')
			return last = i , i ;
	return -1;

}

int main(){

#ifndef ONLINE_JUDGE

	freopen("f.in","r",stdin);
	freopen("f.out","w",stdout);

#endif

	cin >> N >> K ;

	scanf(" %s",s.c_str());

	while( K-- ){

		int c = find();

		if(c==-1) break;

		if(c&1 && s[c]=='4' && s[c+1]=='7' && s[c+2]=='7'){

			if(K & 1)	s[c+1] = '4' ;
			break;

		}

		if(c & 1){
			s[c] = '7';
			s[c+1] = '7' ;
		}else{
			s[c] = '4';
			s[c+1] = '4' ;
		}

		//~ printf("K :%d ==> %s\n",K,s.c_str());

	}

	printf("%s\n",s.c_str());

	return 0;

}


#include <cstdio>
#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>

#define fi first
#define se second

using namespace std;

template <class T> T abs ( T a ){return a>0? a : -a;}
typedef pair<int,int> ii;
typedef long long Lint;

const int MAXN = 105;
const int MAXK = 55;
const int inf = 1e9;

int N,K;
string s;
int last;

int find(){

	for(int i=max(last-5,0);i<N-1;i++)
		if(s[i]=='4' && s[i+1]=='7')
			return last = i , i ;
	return -1;

}

int main(){

#ifndef ONLINE_JUDGE

	freopen("f.in","r",stdin);
	freopen("f.out","w",stdout);

#endif

	cin >> N >> K ;

	scanf(" %s",s.c_str());

	while( K-- ){

		int c = find();
		//~ printf("find:%d\n",c);
		if(c==-1) break;

		if(c<N-2 && c%2==0 && s[c]=='4' && s[c+1]=='7' && s[c+2]=='7'){
			//~ puts("CYC");
			//~ printf("c:%d K:%d\n",c,K);
			if(K%2==0)	s[c+1] = '4' ;
			break;
		}

		if(c % 2 ==1){
			//~ puts("AAA");
			s[c] = '7';
			s[c+1] = '7' ;
		}else{
			//~ puts("BBB");
			s[c] = '4';
			s[c+1] = '4' ;
		}

		//~ printf("K :%d ==> %s\n",K,s.c_str());

	}

	printf("%s\n",s.c_str());

	return 0;

}


#include <cstdio>
#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <algorithm>
#include <cmath>

#define fi first
#define se second

using namespace std;

template <class T> T abs ( T a ){return a>0? a : -a;}
typedef pair<int,int> ii;
typedef long long Lint;

const int MAXN = 105;
const int MAXK = 55;
const int inf = 1e9;

int N,K;
string s;

int find(){

	static int last = 0 ;

	for(int i=max(last-5,0);i<N;i++)
		if(s[i]=='4' && s[i+1]=='7')
			return last = i , i ;
	return -1;

}

int main(){

#ifndef ONLINE_JUDGE

	freopen("f.in","r",stdin);
	freopen("f.out","w",stdout);

#endif

	cin >> N >> K ;

	scanf(" %s",s.c_str());

	while( K-- ){

		int c = find();

		if(c==-1) break;

		if(c&1 && s[c]=='4' && s[c+1]=='7' && s[c+2]=='7'){

			if(K & 1)	s[c+1] = '4' ;
			break;

		}

		if(c & 1){
			s[c] = '7';
			s[c+1] = '7' ;
		}else{
			s[c] = '4';
			s[c+1] = '4' ;
		}

		//~ printf("K :%d ==> %s\n",K,s.c_str());

	}

	printf("%s\n",s.c_str());

	return 0;

}


#include <iostream>
#include <cstdio>
#include <map>
#include <algorithm>
#include <climits>
#include <vector>
#include <cmath>

using namespace std;

int main()
{
	int n , k;
	cin >> n >> k;
	string s;
	cin >> s;
	int start = 0;
	int i = 0 ;

	while ( i < k and start < s.length() ) {
		cout << s << endl;
		int pos = s.find( "47", start );
		if ( pos != -1 ) {
			if ( pos % 2 == 0 ) {
				s[pos] = '4';
				s[pos+1] = '4';
				start = pos + 1;
			} else {
				s[pos] = '7';
				s[pos+1] = '7';
				start = ( (pos == 0 )? 0:pos - 1 );
			}
		} else {
			break;
		}
		i++;
	}

	cout << s << endl;
}


#include <iostream>
#include <cstdio>
#include <map>
#include <algorithm>
#include <climits>
#include <vector>
#include <cmath>

using namespace std;

int main()
{
	int n , k;
	cin >> n >> k;
	string s;
	cin >> s;
	int start = 0;
	int i = 1 ;

	while ( i <= k and start < s.length() ) {
		int pos = s.find( "47", start );
		if ( pos != -1 ) {
			if ( pos % 2 == 0 ) {
				s[pos] = '4';
				s[pos+1] = '4';
				start = pos + 1;
			} else {
				if ( pos > 0 ) {
					if ( s[pos-1] == '4' ) {
						if (  ( k - i + 1 ) % 2 != 0 ) {
							s[pos] = '7';
							s[pos+1] = '7';
							break;
						} else {
							s[pos] = '4';
							s[pos+1] = '7';
							break;
						}
					}
				}
				start = ( (pos == 0 )? 0:pos - 1 );
			}
		} else {
			break;
		}
		i++;
	}

	cout << s << endl;
}


#include <iostream>
#include <cstdio>
#include <map>
#include <algorithm>
#include <climits>
#include <vector>
#include <cmath>

using namespace std;

int main()
{
	int n , k;
	cin >> n >> k;
	string s;
	cin >> s;
	int start = 0;
	int i = 1 ;

	while ( i <= k and start < s.length() ) {
		int pos = s.find( "47", start );
		if ( pos != -1 ) {
			if ( pos % 2 == 0 ) {
				s[pos] = '4';
				s[pos+1] = '4';
				start = pos + 1;
			} else {
				if ( pos > 0 ) {
					if ( s[pos-1] == '4' ) {
						cout << k << " " << i << endl;
						if (  ( k - i + 1 ) % 2 != 0 ) {
							s[pos] = '7';
							s[pos+1] = '7';
							break;
						} else {
							s[pos] = '4';
							s[pos+1] = '7';
							break;
						}
					}
				}
				start = ( (pos == 0 )? 0:pos - 1 );
			}
		} else {
			break;
		}
		i++;
	}

	cout << s << endl;
}


#include <iostream>
#include <cstdio>
#include <map>
#include <algorithm>
#include <climits>
#include <vector>
#include <cmath>

using namespace std;

int main()
{
	int n , k;
	cin >> n >> k;
	string s;
	cin >> s;
	int start = 0;
	int i = 0 ;

	while ( i < k and start < s.length() ) {
		int pos = s.find( "47", start );
		if ( pos != -1 ) {
			if ( pos % 2 == 0 ) {
				s[pos] = '4';
				s[pos+1] = '4';
				start = pos + 1;
			} else {
				s[pos] = '7';
				s[pos+1] = '7';
				start = ( (pos == 0 )? 0:pos - 1 );
			}
		} else {
			break;
		}
		i++;
	}

	cout << s << endl;
}


#include <iostream>
#include <cstdio>
#include <map>
#include <algorithm>
#include <climits>
#include <vector>
#include <cmath>

using namespace std;

int main()
{
	int n , k;
	cin >> n >> k;
	string s;
	cin >> s;
	int start = 0;
	int i = 1 ;

	while ( i <= k and start < s.length() ) {
		int pos = s.find( "47", start );
		if ( pos != -1 ) {
			if ( pos % 2 == 0 ) {
				s[pos] = '4';
				s[pos+1] = '4';
				start = pos;
			} else {
				if ( pos > 0 ) {
					if ( s[pos-1] == '4' ) {
						if (  ( k - i + 1 ) % 2 != 0 ) {
							s[pos] = '7';
							s[pos+1] = '7';
							break;
						} else {
							s[pos] = '4';
							s[pos+1] = '7';
							break;
						}
					}
				}
				s[pos] = '7';
				s[pos+1] = '7';
				start = ( (pos == 0 )? 0:pos - 1 );
			}
		} else {
			break;
		}
		i++;
	}

	cout << s << endl;
}


#include <algorithm>
#include <cstring>
#include <cstdio>
#include <iostream>
#include <fstream>
#include <math.h>
#include <stack>
#include <set>
#include <vector>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int,int> pii;
const int inf = INT_MAX;
const double PI = 3.14159265;
int dpx[4] = {0, 1, 0, -1};
int dpy[4] = {1, 0, -1, 0};
#define dsize(N)	cout.precision(N)
#define ALL(v)		v.begin(),v.end()
#define FORR(a,b,c)	for(int a=b;a<c;a++)
#define FOR(a,b)    FORR(a,0,b)
#define as(v,N)		v.assign(N,0)
#define as2(v,N,M)	v.assign(N,VI(M,0))
#define pb(a) 		push_back(a)
#define sz(v)       v.size()
#define mp(a,b)		make_pair(a,b)
#define in(a)       cin >> a
#define in2(a,b)	cin >> a >> b
#define in3(a,b,c)	cin >> a >> b >> c
#define inv(v,N)	FOR(i,N) in(v[i])
#define out(a)		cout << a
#define out2(a,b)	cout << a << " " << b
#define out3(a,b,c)	cout << a << " " << b << " " << c
#define outs(a)		cout << a << " "
#define outv(v,N)	FOR(i,N) outs(v[i])
#define f           first
#define s           second
int main()
{
	ios::sync_with_stdio(false);
	/*freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);*/
	int N, k, pos = 0;
	char ch;
	VI m;
	in2(N,k);
	FOR(i,N){
		cin >> ch;
		m.pb( ch - '0');
	}
	while( k && pos < N - 1 ){
		if( m[pos] == 4 && m[pos + 1] == 7){
			if(pos % 2){
				m[pos] = 7;
			}
			else{
				m[pos + 1] = 4;
			}
			k--;
		}
		pos++;
	}
	FOR(i,N){
		out(m[i]);
	}
}


#include <algorithm>
#include <cstring>
#include <cstdio>
#include <iostream>
#include <fstream>
#include <math.h>
#include <stack>
#include <set>
#include <vector>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int,int> pii;
const double PI = 3.14159265;
int dpx[4] = {0, 1, 0, -1};
int dpy[4] = {1, 0, -1, 0};
#define dsize(N)	cout.precision(N)
#define ALL(v)		v.begin(),v.end()
#define FORR(a,b,c)	for(int a=b;a<c;a++)
#define FOR(a,b)    FORR(a,0,b)
#define as(v,N)		v.assign(N,0)
#define as2(v,N,M)	v.assign(N,VI(M,0))
#define pb(a) 		push_back(a)
#define sz(v)       v.size()
#define mp(a,b)		make_pair(a,b)
#define in(a)       cin >> a
#define in2(a,b)	cin >> a >> b
#define in3(a,b,c)	cin >> a >> b >> c
#define inv(v,N)	FOR(i,N) in(v[i])
#define out(a)		cout << a
#define out2(a,b)	cout << a << " " << b
#define out3(a,b,c)	cout << a << " " << b << " " << c
#define outs(a)		cout << a << " "
#define outv(v,N)	FOR(i,N) outs(v[i])
#define f           first
#define s           second
int main()
{
	ios::sync_with_stdio(false);
	/*freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);*/
	int N, k, pos = 0;
	char ch;
	VI m;
	in2(N,k);
	FOR(i,N){
		cin >> ch;
		m.pb( ch - '0');
	}
	while( k && pos < N - 1 ){
		if( m[pos] == 4 && m[pos + 1] == 7){
			if(pos % 2){
				m[pos] = 7;
			}
			else{
				m[pos + 1] = 4;
			}
			pos = max( -1, pos - 2);
			k--;
		}
		pos++;
	}
	FOR(i,N){
		out(m[i]);
	}
}


#include <algorithm>
#include <cstring>
#include <cstdio>
#include <iostream>
#include <fstream>
#include <math.h>
#include <stack>
#include <set>
#include <vector>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int,int> pii;
const int inf = INT_MAX;
const double PI = 3.14159265;
int dpx[4] = {0, 1, 0, -1};
int dpy[4] = {1, 0, -1, 0};
#define dsize(N)	cout.precision(N)
#define ALL(v)		v.begin(),v.end()
#define FORR(a,b,c)	for(int a=b;a<c;a++)
#define FOR(a,b)    FORR(a,0,b)
#define as(v,N)		v.assign(N,0)
#define as2(v,N,M)	v.assign(N,VI(M,0))
#define pb(a) 		push_back(a)
#define sz(v)       v.size()
#define mp(a,b)		make_pair(a,b)
#define in(a)       cin >> a
#define in2(a,b)	cin >> a >> b
#define in3(a,b,c)	cin >> a >> b >> c
#define inv(v,N)	FOR(i,N) in(v[i])
#define out(a)		cout << a
#define out2(a,b)	cout << a << " " << b
#define out3(a,b,c)	cout << a << " " << b << " " << c
#define outs(a)		cout << a << " "
#define outv(v,N)	FOR(i,N) outs(v[i])
#define f           first
#define s           second
int main()
{
	ios::sync_with_stdio(false);
	/*freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);*/
	int N, k, pos = 0;
	char ch;
	VI m;
	in2(N,k);
	FOR(i,N){
		cin >> ch;
		m.pb( ch - '0');
	}
	while( k && pos < N - 1 ){
		if( m[pos] == 4 && m[pos + 1] == 7){
			if(pos % 2){
				m[pos] = 7;
			}
			else{
				m[pos + 1] = 4;
			}
			pos = max( 0, pos - 2);
			k--;
		}
		pos++;
	}
	FOR(i,N){
		out(m[i]);
	}
}


#include <algorithm>
#include <cstring>
#include <cstdio>
#include <iostream>
#include <fstream>
#include <math.h>
#include <stack>
#include <set>
#include <vector>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int,int> pii;
const int inf = INT_MAX;
const double PI = 3.14159265;
int dpx[4] = {0, 1, 0, -1};
int dpy[4] = {1, 0, -1, 0};
#define dsize(N)	cout.precision(N)
#define ALL(v)		v.begin(),v.end()
#define FORR(a,b,c)	for(int a=b;a<c;a++)
#define FOR(a,b)    FORR(a,0,b)
#define as(v,N)		v.assign(N,0)
#define as2(v,N,M)	v.assign(N,VI(M,0))
#define pb(a) 		push_back(a)
#define sz(v)       v.size()
#define mp(a,b)		make_pair(a,b)
#define in(a)       cin >> a
#define in2(a,b)	cin >> a >> b
#define in3(a,b,c)	cin >> a >> b >> c
#define inv(v,N)	FOR(i,N) in(v[i])
#define out(a)		cout << a
#define out2(a,b)	cout << a << " " << b
#define out3(a,b,c)	cout << a << " " << b << " " << c
#define outs(a)		cout << a << " "
#define outv(v,N)	FOR(i,N) outs(v[i])
#define f           first
#define s           second
int main()
{
	ios::sync_with_stdio(false);
	/*freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);*/
	int N, k, pos = 0;
	char ch;
	VI m;
	in2(N,k);
	FOR(i,N){
		cin >> ch;
		m.pb( ch - '0');
	}
	while( k && pos < N - 1 ){
		if( m[pos] == 4 && m[pos + 1] == 7){
			if(pos % 2){
				m[pos] = 7;
			}
			else{
				m[pos + 1] = 4;
			}
			k--;
		}
		pos++;
		pos = max( 0, pos - 2);
		k--;
	}
	FOR(i,N){
		out(m[i]);
	}
}


#include <algorithm>
#include <cstring>
#include <cstdio>
#include <iostream>
#include <fstream>
#include <math.h>
#include <stack>
#include <set>
#include <vector>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int,int> pii;
const int inf = INT_MAX;
const double PI = 3.14159265;
int dpx[4] = {0, 1, 0, -1};
int dpy[4] = {1, 0, -1, 0};
#define dsize(N)	cout.precision(N)
#define ALL(v)		v.begin(),v.end()
#define FORR(a,b,c)	for(int a=b;a<c;a++)
#define FOR(a,b)    FORR(a,0,b)
#define as(v,N)		v.assign(N,0)
#define as2(v,N,M)	v.assign(N,VI(M,0))
#define pb(a) 		push_back(a)
#define sz(v)       v.size()
#define mp(a,b)		make_pair(a,b)
#define in(a)       cin >> a
#define in2(a,b)	cin >> a >> b
#define in3(a,b,c)	cin >> a >> b >> c
#define inv(v,N)	FOR(i,N) in(v[i])
#define out(a)		cout << a
#define out2(a,b)	cout << a << " " << b
#define out3(a,b,c)	cout << a << " " << b << " " << c
#define outs(a)		cout << a << " "
#define outv(v,N)	FOR(i,N) outs(v[i])
#define f           first
#define s           second
int main()
{
	ios::sync_with_stdio(false);
	/*freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);*/
	int N, k, pos = 0;
	char ch;
	VI m;
	in2(N,k);
	FOR(i,N){
		cin >> ch;
		m.pb( ch - '0');
	}
	while( k && pos < N - 1 ){
		if( pos < N - 2 && m[pos] == 4 && m[pos + 1] == 4 && m[pos + 2] == 7 && pos % 2 == 0 && k > 3){
			k %= 2;
		}
		if( m[pos] == 4 && m[pos + 1] == 7){
			if(pos % 2){
				m[pos] = 7;
			}
			else{
				m[pos + 1] = 4;
			}
			pos = max( -1, pos - 2);
			k--;
		}
		pos++;
	}
	FOR(i,N){
		out(m[i]);
	}
}


#include <algorithm>
#include <cstring>
#include <cstdio>
#include <iostream>
#include <fstream>
#include <math.h>
#include <stack>
#include <set>
#include <vector>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef pair<int,int> pii;
const int inf = INT_MAX;
const double PI = 3.14159265;
int dpx[4] = {0, 1, 0, -1};
int dpy[4] = {1, 0, -1, 0};
#define dsize(N)	cout.precision(N)
#define ALL(v)		v.begin(),v.end()
#define FORR(a,b,c)	for(int a=b;a<c;a++)
#define FOR(a,b)    FORR(a,0,b)
#define as(v,N)		v.assign(N,0)
#define as2(v,N,M)	v.assign(N,VI(M,0))
#define pb(a) 		push_back(a)
#define sz(v)       v.size()
#define mp(a,b)		make_pair(a,b)
#define in(a)       cin >> a
#define in2(a,b)	cin >> a >> b
#define in3(a,b,c)	cin >> a >> b >> c
#define inv(v,N)	FOR(i,N) in(v[i])
#define out(a)		cout << a
#define out2(a,b)	cout << a << " " << b
#define out3(a,b,c)	cout << a << " " << b << " " << c
#define outs(a)		cout << a << " "
#define outv(v,N)	FOR(i,N) outs(v[i])
#define f           first
#define s           second
int main()
{
	ios::sync_with_stdio(false);
	/*freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);*/
	int N, k, pos = 0;
	char ch;
	VI m;
	in2(N,k);
	FOR(i,N){
		cin >> ch;
		m.pb( ch - '0');
	}
	while( k && pos < N - 1 ){
		if( pos < N - 2 && m[pos] == 4 && m[pos + 1] == 4 && m[pos + 2] == 7 && pos % 2 == 0 && k > 2){
				FOR(i,N){
		out(m[i]);
	}
	return 0;
		}
		if( m[pos] == 4 && m[pos + 1] == 7){
			if(pos % 2){
				m[pos] = 7;
			}
			else{
				m[pos + 1] = 4;
			}
			pos = max( -1, pos - 2);
			k--;
		}
		pos++;
	}
	FOR(i,N){
		out(m[i]);
	}
}


#include<bits/stdc++.h>

using namespace std;

#define PB push_back
#define MP make_pair
#define FOR( i , n ) for( int i = 0; i < (n); i++ )
#define FORR( i , n ) for( int i = ( n - 1 ); i >= 0 ; i-- )
#define DB( x ) cout << #x << " = " << x << endl;
#define OUT( a , n ) for( int J = 0; J < (n); J++ )cout<< (a)[J] << " \n"[J == (n) - 1 ]
#define WAIT cout << flush , system("PAUSE");
#define CONTAINS(a, x) ((a).find(x) != (a).end())

typedef pair<int, int> pii;
typedef long long ll;

const int MAXN = 1e5+10;
char s[MAXN];
int n , k;

int main()
{
    ios::sync_with_stdio( 0 );
    cin.tie( 0 );

    cin >> n >> k;
    cin >> (s+1);

    for( int i = 1; i <= n; i++ )
    {
        if(!k)break;

        if(i % 2 == 0 && s[i] == '4' && s[i+1] == '7' && s[i-1] == '4')
        {
            if(k & 1)
                s[i]  = '7';
            else s[i]  = '4';
            break;
        }
        else if(i % 2 == 0 && s[i] == '4' && s[i+1] == '7')
            s[i] = '7',k--;
        else if(i % 2 == 1 && s[i] == '4' && s[i+1] == '7')
            s[i+1] = '4', k--;
    }

    cout << (s+1) << endl;

    WAIT
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define PB push_back
#define MP make_pair
#define FOR( i , n ) for( int i = 0; i < (n); i++ )
#define FORR( i , n ) for( int i = ( n - 1 ); i >= 0 ; i-- )
#define DB( x ) cout << #x << " = " << x << endl;
#define OUT( a , n ) for( int J = 0; J < (n); J++ )cout<< (a)[J] << " \n"[J == (n) - 1 ]
#define WAIT cout << flush , system("PAUSE");
#define CONTAINS(a, x) ((a).find(x) != (a).end())

typedef pair<int, int> pii;
typedef long long ll;

const int MAXN = 1e5+10;
char s[MAXN];
int n , k;

int main()
{
    ios::sync_with_stdio( 0 );
    cin.tie( 0 );

    cin >> n >> k;
    cin >> (s+1);

    for( int i = 1; i <= n; i++ )
    {
        if(i % 2 == 0 && s[i] == '4' && s[i+1] == '7' && s[i-1] == '4')
        {
            if(k & 1)
                s[i]  = '7';
            else s[i]  = '4';

            break;
        }
        else if(i % 2 == 0 && s[i] == '4' && s[i+1] == '7')
            s[i] = '7',k--;
        else if(i % 2 == 1 && s[i] == '4' && s[i+1] == '7')
            s[i+1] = '4', k--;
    }

    cout << (s+1) << endl;

    //WAIT
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define PB push_back
#define MP make_pair
#define FOR( i , n ) for( int i = 0; i < (n); i++ )
#define FORR( i , n ) for( int i = ( n - 1 ); i >= 0 ; i-- )
#define DB( x ) cout << #x << " = " << x << endl;
#define OUT( a , n ) for( int J = 0; J < (n); J++ )cout<< (a)[J] << " \n"[J == (n) - 1 ]
#define WAIT cout << flush , system("PAUSE");
#define CONTAINS(a, x) ((a).find(x) != (a).end())

typedef pair<int, int> pii;
typedef long long ll;

const int MAXN = 1e5+10;
char s[MAXN];
int n , k;

int main()
{
    ios::sync_with_stdio( 0 );
    cin.tie( 0 );

    cin >> n >> k;
    cin >> (s+1);

    for( int i = 1; i <= n; i++ )
    {
        if(!k)break;

        if(i % 2 == 0 && s[i] == '4' && s[i+1] == '7' && s[i-1] == '4')
        {
            if(k & 1)
                s[i]  = '7';
            else s[i]  = '4';
            break;
        }
        else if(i % 2 == 0 && s[i] == '4' && s[i+1] == '7')
            s[i] = '7',k--;
        else if(i % 2 == 1 && s[i] == '4' && s[i+1] == '7')
            s[i+1] = '4', k--;
    }

    cout << (s+1) << endl;

    //WAIT
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

#define PB push_back
#define MP make_pair
#define FOR( i , n ) for( int i = 0; i < (n); i++ )
#define FORR( i , n ) for( int i = ( n - 1 ); i >= 0 ; i-- )
#define DB( x ) cout << #x << " = " << x << endl;
#define OUT( a , n ) for( int J = 0; J < (n); J++ )cout<< (a)[J] << " \n"[J == (n) - 1 ]
#define WAIT cout << flush , system("PAUSE");
#define CONTAINS(a, x) ((a).find(x) != (a).end())

typedef pair<int, int> pii;
typedef long long ll;

const int MAXN = 1e5+10;
char s[MAXN];
int n , k;

int main()
{
    ios::sync_with_stdio( 0 );
    cin.tie( 0 );

    cin >> n >> k;
    cin >> (s+1);

    for( int i = 1; i <= n; i++ )
    {
        if(i % 2 == 0 && s[i] == '4' && s[i+1] == '7' && s[i-1] == '4')
        {
            if(k & 1)
                s[i]  = '7';
            else s[i]  = '4';
            break;
        }
        else if(i % 2 == 0 && s[i] == '4' && s[i+1] == '7')
            s[i+1] = '7',k--;
        else if(i % 2 == 1 && s[i] == '4' && s[i+1] == '7')
            s[i+1] = '4', k--;
    }

    cout << (s+1) << endl;

    //WAIT
    return 0;
}


#include <cstdio>
#include <algorithm>
#include <numeric>
#include <cctype>
#include <cstring>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <cmath>
#include <iostream>
#include <cstdio>
using namespace std;

std::string str;
int string_size;
int find47();
bool iscircle(int n, int mode);
void solve(int n, int mode);

int main(){
  int N, K;
  cin >>N >> K>> str;
  string_size = str.size();

  for( ; K>=0; --K)
  {
    int find = find47();
    if( iscircle(find, find%2) )
    {
      K %= 2; break;
    }
    else
    {
      solve(find, find%2);
    }
  }

  if( K == 1)
  {
    int find = find47();
    solve(find, find%2);
  }
  cout << str << endl;
  return 0;
}

int find47(){
  int i;
  for(i=0; i<string_size; ++i)
  {
    if( str[i]=='4' && str[i+1]=='7')
      break;
  }
  return i;
}

bool iscircle(int n, int mode){
  //mode = odd
  if(mode == 1)
  {
    if(n == 0)return false;
    if(str[n-1] == '4')
      return true;
  }
  else // even
  {
    if(n == string_size-2)return false;
    if(str[n+2] == '7')
      return true;
  }
  return false;
}

void solve(int n, int mode){
  if(mode == 1)
    str[n] = str[n+1] = '7';
  else
    str[n] = str[n+1] = '4';
}


#include <cstdio>
#include <algorithm>
#include <numeric>
#include <cctype>
#include <cstring>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <cmath>
#include <iostream>
#include <cstdio>
#include <queue>
using namespace std;

std::string str;
std::priority_queue<int> position;
int string_size;
int find47();
bool iscircle(int n, int mode);
void solve(int n, int mode);
void find_all47();

int main(){
  int N, K;
  cin >>N >> K>> str;
  string_size = str.size();

  find_all47();
  for( ; K>0; --K)
  {
    int find = find47();
    if( find == -1){K=0;break;}
    if( iscircle(find, find%2) )
    {
      K %= 2; break;
    }
    else
    {
      solve(find, find%2);
    }
  }

  if( K == 1)
  {
    int find = find47();
    if(find != -1)
      solve(find, find%2);
  }
  cout << str << endl;
  return 0;
}

int find47(){
  if( !position.empty() )
  {
    int no = position.top();
    position.pop();
    return no;
  }
  else
    return -1;
}

bool iscircle(int n, int mode){
  //mode = odd 77
  if(mode == 1)
  {
    if(n == 0)return false;
    if(str[n-1] == '4')
      return true;
  }
  else // even
  {
    if(n == string_size-2)return false;
    if(str[n+2] == '7')
      return true;
  }
  return false;
}

void solve(int n, int mode){
  if(mode == 1)
  {
    str[n] = str[n+1] = '7';
    if( n!=0 && str[n-1] == '4')
      position.push(n-1);
  }
  else
  {
    str[n] = str[n+1] = '4';
    if(n != string_size-2 && str[n+2] == '7')
      position.push(n+1);
  }
}

void find_all47(){
  int i;
  for(i=0; i<string_size-1; ++i)
  {
    if(str[i] == '4' && str[i] == '7')
      position.push(i);
  }
}


#include <cstdio>
#include <algorithm>
#include <numeric>
#include <cctype>
#include <cstring>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <cmath>
#include <iostream>
#include <cstdio>
#include <queue>
using namespace std;

std::string str;
std::priority_queue<int,vector<int>,greater<int>> position;
int string_size;
int find47();
bool iscircle(int n, int mode);
void solve(int n, int mode);
void find_all47();

int main(){
  int N, K;
  cin >>N >> K>> str;
  string_size = str.size();

  find_all47();
  for( ; K>0; --K)
  {
    int find = find47();
    if( find == -1){K=0;break;}
    if( iscircle(find, find%2) )
    {
      K %= 2;
      position.push(find);
      break;
    }
    else
    {
      solve(find, find%2);
    }
  }

  if( K == 1)
  {
    int find = find47();
    if(find != -1)
      solve(find, find%2);
  }
  cout << str << endl;
  return 0;
}

int find47(){
  if( !position.empty() )
  {
    int no = position.top();
    position.pop();
    return no;
  }
  else
    return -1;
}

bool iscircle(int n, int mode){
  //mode = odd 77
  if(mode == 1)
  {
    if(n == 0)return false;
    if(str[n-1] == '4')
      return true;
  }
  else // even
  {
    if(n == string_size-2)return false;
    if(str[n+2] == '7')
      return true;
  }
  return false;
}

void solve(int n, int mode){
  if(mode == 1)
  {
    str[n] = str[n+1] = '7';
    if( n!=0 && str[n-1] == '4')
      position.push(n-1);
  }
  else
  {
    str[n] = str[n+1] = '4';
    if(n != string_size-2 && str[n+2] == '7')
      position.push(n+1);
  }
}

void find_all47(){
  int i;
  for(i=0; i<string_size-1; ++i)
  {
    if(str[i] == '4' && str[i+1] == '7')
      position.push(i);
  }
}


#include <cstdio>
#include <algorithm>
#include <numeric>
#include <cctype>
#include <cstring>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <cmath>
#include <iostream>
#include <cstdio>
using namespace std;

std::string str;
std::vector<int> luck_digit;
int string_size;
int find47();
bool iscircle(int n, int mode);
void solve(int n, int mode);

int main(){
  int N, K;
  cin >>N >> K>> str;
  string_size = str.size();
  for(int i=0; i<string_size; ++i)
  {
    if(str[i] == '4' || str[i] == '7')
      luck_digit.push_back(i);
  }
  if(luck_digit.size() == 0)K = 0;
  for( ; K>0; --K)
  {
    int find = find47();
    if( find == -1){K=0;break;}
    if( iscircle(find, find%2) )
    {
      K %= 2; break;
    }
    else
    {
      solve(find, find%2);
    }
  }

  if( K == 1)
  {
    int find = find47();
    if(find != -1)
      solve(find, find%2);
  }
  cout << str << endl;
  return 0;
}

int find47(){
  int i,no;
  int digit_size = luck_digit.size();
  for(i=0; i<digit_size; ++i)
  {
    no = luck_digit[i];
    if(no == string_size-1)return -1;
    if( str[no]=='4' && str[no+1]=='7')
      break;
  }
  if(i == digit_size)
    return -1;
  return no;
}

bool iscircle(int n, int mode){
  //mode = odd
  if(mode == 1)
  {
    if(n == 0)return false;
    if(str[n-1] == '4')
      return true;
  }
  else // even
  {
    if(n == string_size-2)return false;
    if(str[n+2] == '7')
      return true;
  }
  return false;
}

void solve(int n, int mode){
  if(mode == 1)
    str[n] = str[n+1] = '7';
  else
    str[n] = str[n+1] = '4';
}


#include <cstdio>
#include <algorithm>
#include <numeric>
#include <cctype>
#include <cstring>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <cmath>
#include <iostream>
#include <cstdio>
using namespace std;

std::string str;
std::vector<int> luck_digit;
int string_size;
int find47();
bool iscircle(int n, int mode);
void solve(int n, int mode);

int main(){
  int N, K;
  cin >>N >> K>> str;
  string_size = str.size();
  for(int i=0; i<string_size; ++i)
  {
    if(str[i] == '4' || str[i] == '7')
      luck_digit.push_back(i);
  }

  for( ; K>=0; --K)
  {
    int find = find47();
    if( iscircle(find, find%2) )
    {
      K %= 2; break;
    }
    else
    {
      solve(find, find%2);
    }
  }

  if( K == 1)
  {
    int find = find47();
    solve(find, find%2);
  }
  cout << str << endl;
  return 0;
}

int find47(){
  int i,no;
  int digit_size = luck_digit.size();
  for(i=0; i<digit_size; ++i)
  {
    no = luck_digit[i];
    if( str[no]=='4' && str[no+1]=='7')
      break;
  }
  return no;
}

bool iscircle(int n, int mode){
  //mode = odd
  if(mode == 1)
  {
    if(n == 0)return false;
    if(str[n-1] == '4')
      return true;
  }
  else // even
  {
    if(n == string_size-2)return false;
    if(str[n+2] == '7')
      return true;
  }
  return false;
}

void solve(int n, int mode){
  if(mode == 1)
    str[n] = str[n+1] = '7';
  else
    str[n] = str[n+1] = '4';
}


#include <cstdio>
#include <algorithm>
#include <numeric>
#include <cctype>
#include <cstring>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <cmath>
#include <iostream>
#include <cstdio>
using namespace std;

std::string str;
std::vector<int> luck_digit;
int string_size;
int find47();
bool iscircle(int n, int mode);
void solve(int n, int mode);

int main(){
  int N, K;
  cin >>N >> K>> str;
  string_size = str.size();
  for(int i=0; i<string_size; ++i)
  {
    if(str[i] == '4' || str[i] == '7')
      luck_digit.push_back(i);
  }
  if(luck_digit.size() == 0)K = 0;
  for( ; K>0; --K)
  {
    int find = find47();
    if( iscircle(find, find%2) )
    {
      K %= 2; break;
    }
    else
    {
      solve(find, find%2);
    }
  }

  if( K == 1)
  {
    int find = find47();
    solve(find, find%2);
  }
  cout << str << endl;
  return 0;
}

int find47(){
  int i,no;
  int digit_size = luck_digit.size();
  for(i=0; i<digit_size; ++i)
  {
    no = luck_digit[i];
    if( str[no]=='4' && str[no+1]=='7')
      break;
  }
  return no;
}

bool iscircle(int n, int mode){
  //mode = odd
  if(mode == 1)
  {
    if(n == 0)return false;
    if(str[n-1] == '4')
      return true;
  }
  else // even
  {
    if(n == string_size-2)return false;
    if(str[n+2] == '7')
      return true;
  }
  return false;
}

void solve(int n, int mode){
  if(mode == 1)
    str[n] = str[n+1] = '7';
  else
    str[n] = str[n+1] = '4';
}


#include <cstdio>
#include <algorithm>
#include <numeric>
#include <cctype>
#include <cstring>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <functional>
#include <cmath>
#include <iostream>
#include <cstdio>
#include <queue>
using namespace std;

std::string str;
std::priority_queue<int,vector<int>,greater<int> > position;
int string_size;
int find47();
bool iscircle(int n, int mode);
void solve(int n, int mode);
void find_all47();

int main(){
  int N, K;
  cin >>N >> K>> str;
  string_size = str.size();

  find_all47();
  for( ; K>0; --K)
  {
    int find = find47();
    if( find == -1){K=0;break;}
    if( iscircle(find, find%2) )
    {
      K %= 2;
      position.push(find);
      break;
    }
    else
    {
      solve(find, find%2);
    }
  }

  if( K == 1)
  {
    int find = find47();
    if(find != -1)
      solve(find, find%2);
  }
  cout << str << endl;
  return 0;
}

int find47(){
  if( !position.empty() )
  {
    int no = position.top();
    position.pop();
    return no;
  }
  else
    return -1;
}

bool iscircle(int n, int mode){
  //mode = odd 77
  if(mode == 1)
  {
    if(n == 0)return false;
    if(str[n-1] == '4')
      return true;
  }
  else // even
  {
    if(n == string_size-2)return false;
    if(str[n+2] == '7')
      return true;
  }
  return false;
}

void solve(int n, int mode){
  if(mode == 1)
  {
    str[n] = str[n+1] = '7';
    if( n!=0 && str[n-1] == '4')
      position.push(n-1);
  }
  else
  {
    str[n] = str[n+1] = '4';
    if(n != string_size-2 && str[n+2] == '7')
      position.push(n+1);
  }
}

void find_all47(){
  int i;
  for(i=0; i<string_size-1; ++i)
  {
    if(str[i] == '4' && str[i+1] == '7')
      position.push(i);
  }
}


#include <bits/stdc++.h>
#define int long long
using namespace std;

const int nmax = 100010;
const int inf = 1e9+7;

int n, k;

  set<int> p;
int H=0;
string s;
int pows[nmax+1];
map<int, int> M;

void make(int pos, char c){
   H-=(s[pos]-'a'+1)*pows[pos];
   H+=(c-'a'+1)*pows[pos];
   s[pos]=c;
}

main(){
  cin >> n >> k;
  cin >> s;
  s="#"+s;
  for (int i=1; k && i<=n-1; i++){
     if (s[i]=='4' && s[i+1]=='7'){
        if (i % 2==1){
          s[i+1]='4';
          if (i+2<=n && s[i+2]=='7') {
             k%=2;
          }

        } else
        {
          s[i]='7';
          if (i-1>=1 && s[i-1]=='4') {
             k%=2;
             i--;
          }
        }
     }
  }
  cout << s.substr(1, n) << endl;

}


#include <bits/stdc++.h>
#define int long long
using namespace std;

const int nmax = 100010;
const int inf = 1e9+7;

int n, k;

  set<int> p;
int H=0;
string s;
int pows[nmax+1];
map<int, int> M;

void make(int pos, char c){
   H-=(s[pos]-'a'+1)*pows[pos];
   H+=(c-'a'+1)*pows[pos];
   s[pos]=c;
}

//fewfw
main(){
  cin >> n >> k;
  cin >> s;
  s="#"+s;
  for (int i=2; i<=n; i++)
  {
    if (s[i]=='7' && s[i-1]=='4') p.insert(i-1);
  }
  pows[0]=1;
  for (int i=1; i<=n; i++){
       pows[i]=pows[i-1]*27;

       H+=(s[i]-'a'+1)*pows[i];
  }
  string save = s;
  int kV = k;
  bool bb =0;
  int timer = 0, start;
  while (k-- && (!p.empty())){
    int bg = *p.begin();
    p.erase(bg);
    if (bg%2==1) {
         make(bg+1, '4');
         if (bg+2<=n && s[bg+2]=='7') p.insert(bg+1);
         }else {

         make(bg, '7');
         if (bg-1>=0 && s[bg-1]=='4') p.insert(bg-1);

         }
    timer++;
    if (M.count(H)){
       start = M[H];
       timer = timer-M[H];
       bb = 1;
       break;
    }
    M[H]=timer;

  }
if (!bb) {
 cout << s.substr(1, n) << endl;
 return 0;
}

  timer = start+(kV%timer);
  p.clear();

  for (int i=2; i<=n; i++)
  {
    if (s[i]=='7' && s[i-1]=='4') p.insert(i-1);
  }
  s = save;

   while (timer--){
    int bg = *p.begin();
    p.erase(bg);
    if (bg%2==1) {
         make(bg+1, '4');
         if (bg+2<=n && s[bg+2]=='7') p.insert(bg+1);
         }else {

         make(bg, '7');
         if (bg-1>=0 && s[bg-1]=='4') p.insert(bg-1);

         }

  }
  cout << s.substr(1, n) << endl;

}


#include <bits/stdc++.h>
#define int long long
using namespace std;

const int nmax = 100010;
const int inf = 1e9+7;

int n, k;

  set<int> p;
int H=0;
string s;
int pows[nmax+1];
map<int, int> M;

void make(int pos, char c){
   H-=(s[pos]-'a'+1)*pows[pos];
   H+=(c-'a'+1)*pows[pos];
   s[pos]=c;
}

main(){
  cin >> n >> k;
  cin >> s;
  s="#"+s;
  for (int i=1; k && i<=n-1; i++){
     if (s[i]=='4' && s[i+1]=='7'){
        if (i % 2==1){
          s[i+1]='4';
          if (i+2<=n && s[i+2]=='7') {
             k%=2;
             i--;
          }

        } else
        {
          s[i]='7';
          if (i-1>=1 && s[i-1]=='4') {
             k=(k-1)%2;
             s[i]='4';
             i-=2;
          }
        }
     }
  }
  cout << s.substr(1, n) << endl;

}


#include <bits/stdc++.h>
#define int long long
using namespace std;

const int nmax = 100010;
const int inf = 1e9+7;

int n, k;

  set<int> p;
int H=0;
string s;
int pows[nmax+1];
map<int, int> M;

void make(int pos, char c){
   H-=(s[pos]-'a'+1)*pows[pos];
   H+=(c-'a'+1)*pows[pos];
   s[pos]=c;
}

main(){
  cin >> n >> k;
  cin >> s;
  s="#"+s;
  for (int i=2; i<=n; i++)
  {
    if (s[i]=='7' && s[i-1]=='4') p.insert(i-1);
  }
  pows[0]=1;
  for (int i=1; i<=n; i++){
       pows[i]=pows[i-1]*27;

       H+=(s[i]-'a'+1)*pows[i];
  }
  string save = s;
  int kV = k;
  bool bb =0;
  int timer = 0, start;
  while (k-- && (!p.empty())){
    int bg = *p.begin();
    p.erase(bg);
    if (bg%2==1) {
         make(bg+1, '4');
         if (bg+2<=n && s[bg+2]=='7') p.insert(bg+1);
         }else {

         make(bg, '7');
         if (bg-1>=1 && s[bg-1]=='4') p.insert(bg-1);

         }
    timer++;
    if (M.count(H)){
       start = M[H];
       timer = timer-M[H];
       bb = 1;
       break;
    }
    M[H]=timer;

  }
if (!bb) {
 cout << s.substr(1, n) << endl;
 return 0;
}

  timer = start+(kV%timer);
  p.clear();

  for (int i=2; i<=n; i++)
  {
    if (s[i]=='7' && s[i-1]=='4') p.insert(i-1);
  }
  s = save;

   while (timer--){
    int bg = *p.begin();
    p.erase(bg);
    if (bg%2==1) {
         make(bg+1, '4');
         if (bg+2<=n && s[bg+2]=='7') p.insert(bg+1);
         }else {

         make(bg, '7');
         if (bg-1>=1 && s[bg-1]=='4') p.insert(bg-1);

         }

  }
  cout << s.substr(1, n) << endl;

}


#include <bits/stdc++.h>
#define int long long
using namespace std;

const int nmax = 100010;
const int inf = 1e9+7;

int n, k;

  set<int> p;
int H=0;
string s;
int pows[nmax+1];
map<int, int> M;

void make(int pos, char c){
   H-=(s[pos]-'a'+1)*pows[pos];
   H+=(c-'a'+1)*pows[pos];
   s[pos]=c;
}

main(){
  cin >> n >> k;
  cin >> s;
  s="#"+s;
  for (int i=2; i<=n; i++)
  {
    if (s[i]=='7' && s[i-1]=='4') p.insert(i-1);
  }
  pows[0]=1;
  for (int i=1; i<=n; i++){
       pows[i]=pows[i-1]*27;

       H+=(s[i]-'a'+1)*pows[i];
  }
  string save = s;
  int kV = k;
  bool bb =0;
  int timer = 0, start;
  k = min(k, 100000);
  while (k--){
    int bg = *p.begin();
    p.erase(bg);
    if (bg%2==1) {
         make(bg+1, '4');
         if (bg+2<=n && s[bg+2]=='7') p.insert(bg+1);
         }else {

         make(bg, '7');
         if (bg-1>=0 && s[bg-1]=='4') p.insert(bg-1);

         }
    timer++;
    if (M.count(H)){
       start = M[H];
       timer = timer-M[H];
       bb = 1;
       break;
    }
    M[H]=timer;

  }
 cout << s.substr(1, n) << endl;

}


#include <bits/stdc++.h>
#define int long long
using namespace std;

const int nmax = 100010;
const int inf = 1e9+7;

int n, k;

  set<int> p;
int H=0;
string s;
int pows[nmax+1];
map<int, int> M;

void make(int pos, char c){
   H-=(s[pos]-'a'+1)*pows[pos];
   H+=(c-'a'+1)*pows[pos];
   s[pos]=c;
}

main(){
  cin >> n >> k;
  cin >> s;
  s="#"+s;
  for (int i=2; i<=n; i++)
  {
    if (s[i]=='7' && s[i-1]=='4') p.insert(i-1);
  }
  pows[0]=1;
  for (int i=1; i<=n; i++){
       pows[i]=pows[i-1]*27;

       H+=(s[i]-'a'+1)*pows[i];
  }
  string save = s;
  int kV = k;
  bool bb =0;
  int timer = 0, start;
  k = min(k, 1ll*100000);
  while (k-- && (!p.empty())){
    int bg = *p.begin();
    p.erase(bg);
    if (bg%2==1) {
         make(bg+1, '4');
         if (bg+2<=n && s[bg+2]=='7') p.insert(bg+1);
         }else {

         make(bg, '7');
         if (bg-1>=1 && s[bg-1]=='4') p.insert(bg-1);

         }
    timer++;
  }
 cout << s.substr(1, n) << endl;

}


#include <bits/stdc++.h>
#define int long long
using namespace std;

const int nmax = 100010;
const int inf = 1e9+7;

int n, k;

  set<int> p;
int H=0;
string s;
int pows[nmax+1];
map<int, int> M;

void make(int pos, char c){
   H-=(s[pos]-'a'+1)*pows[pos];
   H+=(c-'a'+1)*pows[pos];
   s[pos]=c;
}

main(){
  cin >> n >> k;
  cin >> s;
  s="#"+s;
  for (int i=2; i<=n; i++)
  {
    if (s[i]=='7' && s[i-1]=='4') p.insert(i-1);
  }
  pows[0]=1;
  for (int i=1; i<=n; i++){
       pows[i]=pows[i-1]*27;

       H+=(s[i]-'a'+1)*pows[i];
  }
  string save = s;
  int kV = k;
  bool bb =0;
  int timer = 0, start;
  k = min(k, 1ll*100000);
  while (k--){
    int bg = *p.begin();
    p.erase(bg);
    if (bg%2==1) {
         make(bg+1, '4');
         if (bg+2<=n && s[bg+2]=='7') p.insert(bg+1);
         }else {

         make(bg, '7');
         if (bg-1>=0 && s[bg-1]=='4') p.insert(bg-1);

         }
    timer++;
    if (M.count(H)){
       start = M[H];
       timer = timer-M[H];
       bb = 1;
       break;
    }
    M[H]=timer;

  }
 cout << s.substr(1, n) << endl;

}


#include <bits/stdc++.h>
#define int long long
using namespace std;

const int nmax = 100010;
const int inf = 1e9+7;

int n, k;

  set<int> p;
int H=0;
string s;
int pows[nmax+1];
map<int, int> M;

void make(int pos, char c){
   H-=(s[pos]-'a'+1)*pows[pos];
   H+=(c-'a'+1)*pows[pos];
   s[pos]=c;
}

main(){
  cin >> n >> k;
  cin >> s;
  s="#"+s;
  for (int i=2; i<=n; i++)
  {
    if (s[i]=='7' && s[i-1]=='4') p.insert(i-1);
  }
  pows[0]=1;
  for (int i=1; i<=n; i++){
       pows[i]=pows[i-1]*27;

       H+=(s[i]-'a'+1)*pows[i];
  }
  string save = s;
  int kV = k;
  bool bb =0;
  int timer = 0, start;
  k = min(k, 1ll*100000);
  while (k-- && (!p.empty())){
    int bg = *p.begin();
    p.erase(bg);
    if (bg%2==1) {
         make(bg+1, '4');
         if (bg+2<=n && s[bg+2]=='7') p.insert(bg+1);
         }else {

         make(bg, '7');
         if (bg-1>=0 && s[bg-1]=='4') p.insert(bg-1);

         }
    timer++;
  }
 cout << s.substr(1, n) << endl;

}


#include <bits/stdc++.h>
#define int long long
using namespace std;

const int nmax = 100010;
const int inf = 1e9+7;

int n, k;

  set<int> p;
int H=0;
string s;
int pows[nmax+1];
map<int, int> M;

void make(int pos, char c){
   H-=(s[pos]-'a'+1)*pows[pos];
   H+=(c-'a'+1)*pows[pos];
   s[pos]=c;
}

main(){
  cin >> n >> k;
  cin >> s;
  s="#"+s;
  for (int i=2; i<=n; i++)
  {
    if (s[i]=='7' && s[i-1]=='4') p.insert(i-1);
  }
  pows[0]=1;
  for (int i=1; i<=n; i++){
       pows[i]=pows[i-1]*27;

       H+=(s[i]-'a'+1)*pows[i];
  }
  string save = s;
  int kV = k;
  bool bb =0;
  int timer = 0, start;
  while (k-- && (!p.empty())){
    int bg = *p.begin();
    p.erase(bg);
    if (bg%2==1) {
         make(bg+1, '4');
         if (bg+2<=n && s[bg+2]=='7') p.insert(bg+1);
         }else {

         make(bg, '7');
         if (bg-1>=1 && s[bg-1]=='4') p.insert(bg-1);

         }
    timer++;
  }
 cout << s.substr(1, n) << endl;

}


/*
 * d.cpp
 *
 */

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <complex>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

#define forn(i, n) for (int i = 0; i < (n); ++i)
#define foreach(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); ++it)

vector<int> touched;

bool perform(string &s, int &k, int &i) {
	if (k == 0)
		return false;
	for (; i + 1 < (int) s.size(); ++i)
		if (s[i] == '4' && s[i + 1] == '7')
			break;
	if (i + 1 < (int) s.size())
		s[i] = s[i + 1] = (i % 2 ? '7' : '4');
	else
		return false;
	bool cycle = true;
	forn(j, i)
		if (touched[j] < touched[i]) {
			cycle = false;
			break;
		}
	if (cycle && touched[i] > 0) {
		int len = touched[i] - k;
		touched[i] = k;
		k = (k - 1) % len;
		touched.assign(touched.size(), 0);
	} else {
		touched[i] = k;
		--k;
	}
	i = (i % 2 ? max(0, i - 1) : i + 1);
	return true;
}

int main(void) {
	int n, k, i = 0;
	string s;
	cin >> n >> k >> s;
	touched.assign(n, 0);
	while (perform(s, k, i))
		;
	cout << s << endl;
	return 0;
}


/*
 * d.cpp
 *
 */

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <complex>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

#define forn(i, n) for (int i = 0; i < (n); ++i)
#define foreach(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); ++it)

int n, k, i = 0;
string s;

bool perform(string &s) {
	if (k == 0)
		return false;
	for (; i + 1 < n; ++i)
		if (s[i] == '4' && s[i + 1] == '7')
			break;
	if (i + 1 < n)
		s[i] = s[i + 1] = (i % 2 ? '7' : '4');
	else
		return false;
	--k;
	if (i % 2 == 0 && i + 2 < n && s[i + 2] == '7')
		k %= 2;
	i = (i % 2 ? max(0, i - 1) : i + 1);
	return true;
}

int main(void) {
	cin >> n >> k >> s;
	while (perform(s))
		;
	cout << s << endl;
	return 0;
}


/*
 * d.cpp
 *
 */

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <complex>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

#define forn(i, n) for (int i = 0; i < (n); ++i)
#define foreach(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); ++it)

int n, k, i = 0;
vector<int> touched;

bool perform(string &s) {
	if (k == 0)
		return false;
	for (; i + 1 < n; ++i)
		if (s[i] == '4' && s[i + 1] == '7')
			break;
	if (i + 1 < n)
		s[i] = s[i + 1] = (i % 2 ? '7' : '4');
	else
		return false;
	bool cycle = true;
	forn(j, i)
		if (touched[j] < touched[i]) {
			cycle = false;
			break;
		}
	if (cycle && touched[i] > 0) {
		int len = touched[i] - k;
		touched[i] = k;
		k = (k - 1) % len;
		touched.assign(n, 0);
	} else {
		touched[i] = k;
		--k;
	}
	i = (i % 2 ? max(0, i - 1) : i + 1);
	return true;
}

int main(void) {
	string s;
	cin >> n >> k >> s;
	touched.assign(n, 0);
	while (perform(s))
		;
	cout << s << endl;
	return 0;
}


/*
 * d.cpp
 *
 */

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <complex>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

#define forn(i, n) for (int i = 0; i < (n); ++i)
#define foreach(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); ++it)

vector<int> touched;

bool perform(string &s, int &k, int &i) {
	if (k == 0)
		return false;
	for (; i + 1 < (int) s.size(); ++i)
		if (s[i] == '4' && s[i + 1] == '7')
			break;
	if (i + 1 < (int) s.size())
		s[i] = s[i + 1] = (i % 2 ? '7' : '4');
	else
		return false;
	bool cycle = true;
	forn(j, i)
		if (touched[j] > touched[i]) {
			cycle = false;
			break;
		}
	if (cycle && touched[i] > 0) {
		int len = touched[i] - k;
		touched[i] = k;
		k = (k - 1) % len;
	} else
		--k;
	i = (i % 2 ? max(0, i - 1) : i + 1);
	return true;
}

int main(void) {
	int n, k, i = 0;
	string s;
	cin >> n >> k >> s;
	touched.assign(n, 0);
	while (perform(s, k, i))
		;
	cout << s << endl;
	return 0;
}


/*
 * d.cpp
 *
 */

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <complex>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

#define forn(i, n) for (int i = 0; i < (n); ++i)
#define foreach(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); ++it)

vector<int> touched;

bool perform(string &s, int &k, int &i) {
	if (k == 0)
		return false;
	for (; i + 1 < (int) s.size(); ++i)
		if (s[i] == '4' && s[i + 1] == '7')
			break;
	if (i + 1 < (int) s.size())
		s[i] = s[i + 1] = (i % 2 ? '7' : '4');
	else
		return false;
	bool cycle = true;
	forn(j, i)
		if (touched[j] < touched[i]) {
			cycle = false;
			break;
		}
	if (cycle && touched[i] > 0) {
		int len = touched[i] - k;
		touched[i] = k;
		k = (k - 1) % len;
	} else
		--k;
	i = (i % 2 ? max(0, i - 1) : i + 1);
	return true;
}

int main(void) {
	int n, k, i = 0;
	string s;
	cin >> n >> k >> s;
	touched.assign(n, 0);
	while (perform(s, k, i))
		;
	cout << s << endl;
	return 0;
}


/*
 * d.cpp
 *
 */

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <complex>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

#define forn(i, n) for (int i = 0; i < (n); ++i)
#define foreach(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); ++it)

vector<int> touched;

bool perform(string &s, int &k, int &i) {
	if (k == 0)
		return false;
	for (; i + 1 < (int) s.size(); ++i)
		if (s[i] == '4' && s[i + 1] == '7')
			break;
	if (i + 1 < (int) s.size())
		s[i] = s[i + 1] = (i % 2 ? '7' : '4');
	else
		return false;
	bool cycle = true;
	forn(j, i)
		if (touched[j] < touched[i]) {
			cycle = false;
			break;
		}
	if (cycle && touched[i] > 0) {
		int len = touched[i] - k;
		touched[i] = k;
		k = (k - 1) % len;
		touched.assign(touched.size(), 0);
	} else
		--k;
	i = (i % 2 ? max(0, i - 1) : i + 1);
	return true;
}

int main(void) {
	int n, k, i = 0;
	string s;
	cin >> n >> k >> s;
	touched.assign(n, 0);
	while (perform(s, k, i))
		;
	cout << s << endl;
	return 0;
}


/*
 * d.cpp
 *
 */

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <complex>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

#define forn(i, n) for (int i = 0; i < (n); ++i)
#define foreach(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); ++it)

vector<int> touched;

int perform(string &s, int k) {
	if (k == 0)
		return 0;
	int i = 0;
	for (; i + 1 < (int) s.size(); ++i)
		if (s[i] == '4' && s[i + 1] == '7')
			break;
	if (i + 1 < (int) s.size())
		s[i] = s[i + 1] = (i % 2 ? '7' : '4');
	else return 0;
	bool cycle = true;
	forn(j, i)
		if (touched[j] > 0) {
			cycle = false;
			break;
		}
	if (cycle && touched[i] > 0) {
		int len = touched[i] - k;
		touched[i] = k;
		return (k - 1) % len;
	} else
		return k - 1;
}

int main(void) {
	int n, k;
	string s;
	cin >> n >> k >> s;
	touched.assign(n, 0);
	while ((k = perform(s, k)));
	cout << s << endl;
	return 0;
}


/*
 * d.cpp
 *
 */

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <complex>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

#define forn(i, n) for (int i = 0; i < (n); ++i)
#define foreach(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); ++it)

vector<int> touched;

bool perform(string &s, int &k, int &i) {
	if (k == 0)
		return false;
	for (; i + 1 < (int) s.size(); ++i)
		if (s[i] == '4' && s[i + 1] == '7')
			break;
	if (i + 1 < (int) s.size())
		s[i] = s[i + 1] = (i % 2 ? '7' : '4');
	else
		return false;
	bool cycle = true;
	forn(j, i)
		if (touched[j] > 0) {
			cycle = false;
			break;
		}
	if (cycle && touched[i] > 0) {
		int len = touched[i] - k;
		touched[i] = k;
		k = (k - 1) % len;
	} else
		--k;
	i = (i % 2 ? max(0, i - 1) : i + 1);
	return true;
}

int main(void) {
	int n, k, i = 0;
	string s;
	cin >> n >> k >> s;
	touched.assign(n, 0);
	while (perform(s, k, i))
		;
	cout << s << endl;
	return 0;
}


/*
 * d.cpp
 *
 */

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <complex>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

#define forn(i, n) for (int i = 0; i < (n); ++i)
#define foreach(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); ++it)

vector<int> touched;

bool perform(string &s, int &k, int &i) {
	if (k == 0)
		return false;
	for (; i + 1 < (int) s.size(); ++i)
		if (s[i] == '4' && s[i + 1] == '7')
			break;
	if (i + 1 < (int) s.size())
		s[i] = s[i + 1] = (i % 2 ? '7' : '4');
	else
		return false;
	bool cycle = true;
	forn(j, i)
		if (touched[j] < touched[i]) {
			cycle = false;
			break;
		}
	if (cycle && touched[i] > 0) {
		int len = touched[i] - k;
		touched[i] = k;
		k = (k - 1) % len;
	} else {
		touched[i] = k;
		--k;
	}
	i = (i % 2 ? max(0, i - 1) : i + 1);
	return true;
}

int main(void) {
	int n, k, i = 0;
	string s;
	cin >> n >> k >> s;
	touched.assign(n, 0);
	while (perform(s, k, i))
		;
	cout << s << endl;
	return 0;
}


/*
 * d.cpp
 *
 */

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <complex>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

#define forn(i, n) for (int i = 0; i < (n); ++i)
#define foreach(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); ++it)

vector<int> touched;

bool perform(string &s, int &k, int &i) {
	if (k == 0)
		return false;
	for (; i + 1 < (int) s.size(); ++i)
		if (s[i] == '4' && s[i + 1] == '7')
			break;
	if (i + 1 < (int) s.size())
		s[i] = s[i + 1] = (i % 2 ? '7' : '4');
	else
		return false;
	bool cycle = true;
	forn(j, i)
		if (touched[j] > 0) {
			cycle = false;
			break;
		}
	if (cycle && touched[i] > 0) {
		int len = touched[i] - k;
		touched[i] = k;
		k = (k - 1) % len;
		touched.assign(touched.size(), 0);
	} else
		--k;
	i = (i % 2 ? max(0, i - 1) : i + 1);
	return true;
}

int main(void) {
	int n, k, i = 0;
	string s;
	cin >> n >> k >> s;
	touched.assign(n, 0);
	while (perform(s, k, i))
		;
	cout << s << endl;
	return 0;
}


/*
 * d.cpp
 *
 */

#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <complex>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>

using namespace std;

#define forn(i, n) for (int i = 0; i < (n); ++i)
#define foreach(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); ++it)

vector<int> touched;

int perform(string &s, int k) {
	if (k == 0)
		return 0;
	int i = 0;
	for (; i < (int) s.size() - 1; ++i)
		if (s[i] == '4' && s[i + 1] == '7')
			break;
	s[i] = s[i + 1] = (i % 2 ? '7' : '4');
	bool cycle = true;
	forn(j, i)
		if (touched[j] > 0) {
			cycle = false;
			break;
		}
	if (cycle && touched[i] > 0) {
		int len = touched[i] - k;
		touched[i] = k;
		return (k - 1) % len;
	} else
		return k - 1;
}

int main(void) {
	int n, k;
	string s;
	cin >> n >> k >> s;
	touched.assign(n, 0);
	while ((k = perform(s, k)));
	cout << s << endl;
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <set>
#include <map>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <cstdio>
#include <vector>
#include <cctype>
#include <climits>
#include <sstream>
#include <cstdlib>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

#define fast ios_base::sync_with_stdio(false)

#define si(a) cin>>a
#define si2(a,b) cin>>a>>b
#define si3(a,b,c) cin>>a>>b>>c

#define read freopen("in.in","r",stdin)
#define write freopen("out.in","w",stdout)

#define rep(i,a,b) for(int i=a;i<b;++i)
#define rep_(i,a,b) for(int i=a;i>=b;--i)
#define wh(t) while(t--)

#define Set(a,b) memset(a,b,sizeof a)
#define Vset(a,b,c) a.resize(b,c)
#define clr(a) a.clear()
#define Sz(a) a.size()
#define Arrsz(a) sizeof a / sizeof a[0]
#define All(a) (a.begin(),a.end())
#define mp make_pair

#define Bug puts("Bug")
#define Nl puts("");
#define Vi vector
#define pr pair
#define N 9999999999

#define isnum(a) (a>=48 && a<=57)
#define isS(a) (a>='a' && a<='z')
#define isU(a) (a>='A' && a<='Z')
#define toS(a) (isU(a)?a+32:a)
#define toU(a) (isS(a)?a-32:a)
#define toC(a) a&15

typedef long long lli;
typedef unsigned long long llu;
typedef Vi<int> vi;
typedef pr<int, int> pii;
typedef pr<pii, int> piii;
typedef map<int, int>::iterator Mit;
typedef set<lli>::iterator Sit;

int gcd(int a, int b){ return (a == 0) ? b : (b == 0) ? a : gcd(b, a%b); }
int str_div(char *s, int n){ int y = 0, ln = strlen(s); rep(i, 0, ln)y = (y * 10 + (s[i] - 48)) % n; return y; }
int get(){
    int y = 0, s = 1, i = 10;
    char c = getchar();
    while (!isnum(c)){
        if (c == '-')s = -1; c = getchar();
    }
    while (isnum(c))y = (y << 1) + (y << 3) + (toC(c)), c = getchar();
    if (c != '.')return y;
    c = getchar();
    while (isnum(c))y = y + (toC(c)) / i, i = (i << 1) + (i << 3), c = getchar();
    return y*s;
}

int dx[] = { 1, -1, 0, 0, 1, 1, -1, -1 };
int dy[] = { 0, 0, 1, -1, -1, 1, -1, 1 };
int main()
{
    fast;
    int n, m;
    si2(n, m);
    string s1;
    si(s1);
    while (m)
    {
        rep(i, 0, n - 1)
        {
            if (s1[i] == '4' && s1[i + 1] == '7')
            {
                --m;
                if (i % 2)
                    s1[i] = s1[i + 1] = '7';
                else
                    s1[i] = s1[i + 1] = '4';

                break;
            }
        }
    }
    cout << s1 << endl;

    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <set>
#include <map>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <cstdio>
#include <vector>
#include <cctype>
#include <climits>
#include <sstream>
#include <cstdlib>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

#define fast ios_base::sync_with_stdio(false)

#define si(a) cin>>a
#define si2(a,b) cin>>a>>b
#define si3(a,b,c) cin>>a>>b>>c

#define read freopen("in.in","r",stdin)
#define write freopen("out.in","w",stdout)

#define rep(i,a,b) for(int i=a;i<b;++i)
#define rep_(i,a,b) for(int i=a;i>=b;--i)
#define wh(t) while(t--)

#define Set(a,b) memset(a,b,sizeof a)
#define Vset(a,b,c) a.resize(b,c)
#define clr(a) a.clear()
#define Sz(a) a.size()
#define Arrsz(a) sizeof a / sizeof a[0]
#define All(a) (a.begin(),a.end())
#define mp make_pair

#define Bug puts("Bug")
#define Nl puts("");
#define Vi vector
#define pr pair
#define N 9999999999

#define isnum(a) (a>=48 && a<=57)
#define isS(a) (a>='a' && a<='z')
#define isU(a) (a>='A' && a<='Z')
#define toS(a) (isU(a)?a+32:a)
#define toU(a) (isS(a)?a-32:a)
#define toC(a) a&15

typedef long long lli;
typedef unsigned long long llu;
typedef Vi<int> vi;
typedef pr<int, int> pii;
typedef pr<pii, int> piii;
typedef map<int, int>::iterator Mit;
typedef set<lli>::iterator Sit;

int gcd(int a, int b){ return (a == 0) ? b : (b == 0) ? a : gcd(b, a%b); }
int str_div(char *s, int n){ int y = 0, ln = strlen(s); rep(i, 0, ln)y = (y * 10 + (s[i] - 48)) % n; return y; }
int get(){
    int y = 0, s = 1, i = 10;
    char c = getchar();
    while (!isnum(c)){
        if (c == '-')s = -1; c = getchar();
    }
    while (isnum(c))y = (y << 1) + (y << 3) + (toC(c)), c = getchar();
    if (c != '.')return y;
    c = getchar();
    while (isnum(c))y = y + (toC(c)) / i, i = (i << 1) + (i << 3), c = getchar();
    return y*s;
}

int dx[] = { 1, -1, 0, 0, 1, 1, -1, -1 };
int dy[] = { 0, 0, 1, -1, -1, 1, -1, 1 };
int main()
{
    fast;
    int n, m;
    si2(n, m);
    string s1;
    si(s1);
    if (m % 2)m = 1; else m = 2;
    rep(i, 0, m)
    {
        rep(j, 0, n - 1)
        {
            if (s1[j] == '4' && s1[j + 1]=='7')
            {
                if (j % 2==0)
                    s1[j + 1] = '4';
                else
                    s1[j] = '7';
                break;
            }
        }
    }
    cout << s1 << endl;

    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <set>
#include <map>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <cstdio>
#include <vector>
#include <cctype>
#include <climits>
#include <sstream>
#include <cstdlib>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

#define fast ios_base::sync_with_stdio(false)

#define si(a) cin>>a
#define si2(a,b) cin>>a>>b
#define si3(a,b,c) cin>>a>>b>>c

#define read freopen("in.in","r",stdin)
#define write freopen("out.in","w",stdout)

#define rep(i,a,b) for(int i=a;i<b;++i)
#define rep_(i,a,b) for(int i=a;i>=b;--i)
#define wh(t) while(t--)

#define Set(a,b) memset(a,b,sizeof a)
#define Vset(a,b,c) a.resize(b,c)
#define clr(a) a.clear()
#define Sz(a) a.size()
#define Arrsz(a) sizeof a / sizeof a[0]
#define All(a) (a.begin(),a.end())
#define mp make_pair

#define Bug puts("Bug")
#define Nl puts("");
#define Vi vector
#define pr pair
#define N 9999999999

#define isnum(a) (a>=48 && a<=57)
#define isS(a) (a>='a' && a<='z')
#define isU(a) (a>='A' && a<='Z')
#define toS(a) (isU(a)?a+32:a)
#define toU(a) (isS(a)?a-32:a)
#define toC(a) a&15

typedef long long lli;
typedef unsigned long long llu;
typedef Vi<int> vi;
typedef pr<int, int> pii;
typedef pr<pii, int> piii;
typedef map<int, int>::iterator Mit;
typedef set<lli>::iterator Sit;

int gcd(int a, int b){ return (a == 0) ? b : (b == 0) ? a : gcd(b, a%b); }
int str_div(char *s, int n){ int y = 0, ln = strlen(s); rep(i, 0, ln)y = (y * 10 + (s[i] - 48)) % n; return y; }
int get(){
    int y = 0, s = 1, i = 10;
    char c = getchar();
    while (!isnum(c)){
        if (c == '-')s = -1; c = getchar();
    }
    while (isnum(c))y = (y << 1) + (y << 3) + (toC(c)), c = getchar();
    if (c != '.')return y;
    c = getchar();
    while (isnum(c))y = y + (toC(c)) / i, i = (i << 1) + (i << 3), c = getchar();
    return y*s;
}

int dx[] = { 1, -1, 0, 0, 1, 1, -1, -1 };
int dy[] = { 0, 0, 1, -1, -1, 1, -1, 1 };
int main()
{
    fast;
    si2(n, m);
    string s1;
    si(s1);
    if (m % 2)m = 1; else m = 2;
    rep(i, 0, m)
    {
        rep(j, 0, n - 1)
        {
            if (s1[j] == '4' && s1[j + 1]=='7')
            {
                if (j % 2==0)
                    s1[j + 1] = '4';
                else
                    s1[j] = '7';
                break;
            }
        }
    }
    cout << s1 << endl;

    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <set>
#include <map>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <cstdio>
#include <vector>
#include <cctype>
#include <climits>
#include <sstream>
#include <cstdlib>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

#define fast ios_base::sync_with_stdio(false)

#define si(a) cin>>a
#define si2(a,b) cin>>a>>b
#define si3(a,b,c) cin>>a>>b>>c

#define read freopen("in.in","r",stdin)
#define write freopen("out.in","w",stdout)

#define rep(i,a,b) for(int i=a;i<b;++i)
#define rep_(i,a,b) for(int i=a;i>=b;--i)
#define wh(t) while(t--)

#define Set(a,b) memset(a,b,sizeof a)
#define Vset(a,b,c) a.resize(b,c)
#define clr(a) a.clear()
#define Sz(a) a.size()
#define Arrsz(a) sizeof a / sizeof a[0]
#define All(a) (a.begin(),a.end())
#define mp make_pair

#define Bug puts("Bug")
#define Nl puts("");
#define Vi vector
#define pr pair
#define N 9999999999

#define isnum(a) (a>=48 && a<=57)
#define isS(a) (a>='a' && a<='z')
#define isU(a) (a>='A' && a<='Z')
#define toS(a) (isU(a)?a+32:a)
#define toU(a) (isS(a)?a-32:a)
#define toC(a) a&15

typedef long long lli;
typedef unsigned long long llu;
typedef Vi<int> vi;
typedef pr<int, int> pii;
typedef pr<pii, int> piii;
typedef map<int, int>::iterator Mit;
typedef set<lli>::iterator Sit;

int gcd(int a, int b){ return (a == 0) ? b : (b == 0) ? a : gcd(b, a%b); }
int str_div(char *s, int n){ int y = 0, ln = strlen(s); rep(i, 0, ln)y = (y * 10 + (s[i] - 48)) % n; return y; }
int get(){
	int y = 0, s = 1, i = 10;
	char c = getchar();
	while (!isnum(c)){
		if (c == '-')s = -1; c = getchar();
	}
	while (isnum(c))y = (y << 1) + (y << 3) + (toC(c)), c = getchar();
	if (c != '.')return y;
	c = getchar();
	while (isnum(c))y = y + (toC(c)) / i, i = (i << 1) + (i << 3), c = getchar();
	return y*s;
}

int dx[] = { 1, -1, 0, 0, 1, 1, -1, -1 };
int dy[] = { 0, 0, 1, -1, -1, 1, -1, 1 };
int main()
{
	fast;
	int n= get(), m = get();
	string s1;
	si(s1);
	if (m % 2)m = 1; else m = 2;
	rep(i, 0, m)
	{
		rep(j, 0, n - 1)
		{
			if (s1[j] == '4' && s1[j + 1]=='7')
			{
				if (j % 2==0)
					s1[j + 1] = '4';
				else
					s1[j] = '7';
				break;
			}
		}
	}
	cout << s1 << endl;

	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <set>
#include <map>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <cstdio>
#include <vector>
#include <cctype>
#include <climits>
#include <sstream>
#include <cstdlib>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

#define fast ios_base::sync_with_stdio(false)

#define si(a) cin>>a
#define si2(a,b) cin>>a>>b
#define si3(a,b,c) cin>>a>>b>>c

#define read freopen("in.in","r",stdin)
#define write freopen("out.in","w",stdout)

#define rep(i,a,b) for(int i=a;i<b;++i)
#define rep_(i,a,b) for(int i=a;i>=b;--i)
#define wh(t) while(t--)

#define Set(a,b) memset(a,b,sizeof a)
#define Vset(a,b,c) a.resize(b,c)
#define clr(a) a.clear()
#define Sz(a) a.size()
#define Arrsz(a) sizeof a / sizeof a[0]
#define All(a) (a.begin(),a.end())
#define mp make_pair

#define Bug puts("Bug")
#define Nl puts("");
#define Vi vector
#define pr pair
#define N 9999999999

#define isnum(a) (a>=48 && a<=57)
#define isS(a) (a>='a' && a<='z')
#define isU(a) (a>='A' && a<='Z')
#define toS(a) (isU(a)?a+32:a)
#define toU(a) (isS(a)?a-32:a)
#define toC(a) a&15

typedef long long lli;
typedef unsigned long long llu;
typedef Vi<int> vi;
typedef pr<int, int> pii;
typedef pr<pii, int> piii;
typedef map<int, int>::iterator Mit;
typedef set<lli>::iterator Sit;

int gcd(int a, int b){ return (a == 0) ? b : (b == 0) ? a : gcd(b, a%b); }
int str_div(char *s, int n){ int y = 0, ln = strlen(s); rep(i, 0, ln)y = (y * 10 + (s[i] - 48)) % n; return y; }
int get(){
    int y = 0, s = 1, i = 10;
    char c = getchar();
    while (!isnum(c)){
        if (c == '-')s = -1; c = getchar();
    }
    while (isnum(c))y = (y << 1) + (y << 3) + (toC(c)), c = getchar();
    if (c != '.')return y;
    c = getchar();
    while (isnum(c))y = y + (toC(c)) / i, i = (i << 1) + (i << 3), c = getchar();
    return y*s;
}

int dx[] = { 1, -1, 0, 0, 1, 1, -1, -1 };
int dy[] = { 0, 0, 1, -1, -1, 1, -1, 1 };
int main()
{
    fast;
    int n, m;
    si2(n, m);
    string s1;
    si(s1);
    --n;
    for (int i = 0; m&& i < n;++i){
        if (s1[i] == '4' && s1[i + 1] == '7')
        {
            --m;
            if (i % 2){
                s1[i] = s1[i + 1] = '7';
                i -= 2;
                if (s1[i + 1] == '4')
                    m &= 1;
            }
            else
                s1[i] = s1[i + 1] = '4';
        }
    }
    cout << s1 << endl;
    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <set>
#include <map>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <cstdio>
#include <vector>
#include <cctype>
#include <climits>
#include <sstream>
#include <cstdlib>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

#define fast ios_base::sync_with_stdio(false)

#define si(a) cin>>a
#define si2(a,b) cin>>a>>b
#define si3(a,b,c) cin>>a>>b>>c

#define read freopen("in.in","r",stdin)
#define write freopen("out.in","w",stdout)

#define rep(i,a,b) for(int i=a;i<b;++i)
#define rep_(i,a,b) for(int i=a;i>=b;--i)
#define wh(t) while(t--)

#define Set(a,b) memset(a,b,sizeof a)
#define Vset(a,b,c) a.resize(b,c)
#define clr(a) a.clear()
#define Sz(a) a.size()
#define Arrsz(a) sizeof a / sizeof a[0]
#define All(a) (a.begin(),a.end())
#define mp make_pair

#define Bug puts("Bug")
#define Nl puts("");
#define Vi vector
#define pr pair
#define N 9999999999

#define isnum(a) (a>=48 && a<=57)
#define isS(a) (a>='a' && a<='z')
#define isU(a) (a>='A' && a<='Z')
#define toS(a) (isU(a)?a+32:a)
#define toU(a) (isS(a)?a-32:a)
#define toC(a) a&15

typedef long long lli;
typedef unsigned long long llu;
typedef Vi<int> vi;
typedef pr<int, int> pii;
typedef pr<pii, int> piii;
typedef map<int, int>::iterator Mit;
typedef set<lli>::iterator Sit;

int gcd(int a, int b){ return (a == 0) ? b : (b == 0) ? a : gcd(b, a%b); }
int str_div(char *s, int n){ int y = 0, ln = strlen(s); rep(i, 0, ln)y = (y * 10 + (s[i] - 48)) % n; return y; }
int get(){
    int y = 0, s = 1, i = 10;
    char c = getchar();
    while (!isnum(c)){
        if (c == '-')s = -1; c = getchar();
    }
    while (isnum(c))y = (y << 1) + (y << 3) + (toC(c)), c = getchar();
    if (c != '.')return y;
    c = getchar();
    while (isnum(c))y = y + (toC(c)) / i, i = (i << 1) + (i << 3), c = getchar();
    return y*s;
}

int dx[] = { 1, -1, 0, 0, 1, 1, -1, -1 };
int dy[] = { 0, 0, 1, -1, -1, 1, -1, 1 };
int main()
{
    fast;
    int n, m;
    si2(n, m);
    string s1;
    si(s1);
    --n;
    while (m)rep(i, 0, n){
        if (s1[i] == '4' && s1[i + 1] == '7')
        {
            --m;
            if (i % 2){
                s1[i] = s1[i + 1] = '7';
                i -= 2;
                if (s1[i + 1] == '4')
                    m &= 1;
            }
            else
                s1[i] = s1[i + 1] = '4';
        }
        if (i == n - 1)m = 0;
    }
    cout << s1 << endl;
    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <set>
#include <map>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <cstdio>
#include <vector>
#include <cctype>
#include <climits>
#include <sstream>
#include <cstdlib>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

#define fast ios_base::sync_with_stdio(false)

#define si(a) cin>>a
#define si2(a,b) cin>>a>>b
#define si3(a,b,c) cin>>a>>b>>c

#define read freopen("in.in","r",stdin)
#define write freopen("out.in","w",stdout)

#define rep(i,a,b) for(int i=a;i<b;++i)
#define rep_(i,a,b) for(int i=a;i>=b;--i)
#define wh(t) while(t--)

#define Set(a,b) memset(a,b,sizeof a)
#define Vset(a,b,c) a.resize(b,c)
#define clr(a) a.clear()
#define Sz(a) a.size()
#define Arrsz(a) sizeof a / sizeof a[0]
#define All(a) (a.begin(),a.end())
#define mp make_pair

#define Bug puts("Bug")
#define Nl puts("");
#define Vi vector
#define pr pair
#define N 9999999999

#define isnum(a) (a>=48 && a<=57)
#define isS(a) (a>='a' && a<='z')
#define isU(a) (a>='A' && a<='Z')
#define toS(a) (isU(a)?a+32:a)
#define toU(a) (isS(a)?a-32:a)
#define toC(a) a&15

typedef long long lli;
typedef unsigned long long llu;
typedef Vi<int> vi;
typedef pr<int, int> pii;
typedef pr<pii, int> piii;
typedef map<int, int>::iterator Mit;
typedef set<lli>::iterator Sit;

int gcd(int a, int b){ return (a == 0) ? b : (b == 0) ? a : gcd(b, a%b); }
int str_div(char *s, int n){ int y = 0, ln = strlen(s); rep(i, 0, ln)y = (y * 10 + (s[i] - 48)) % n; return y; }
int get(){
	int y = 0, s = 1, i = 10;
	char c = getchar();
	while (!isnum(c)){
		if (c == '-')s = -1; c = getchar();
	}
	while (isnum(c))y = (y << 1) + (y << 3) + (toC(c)), c = getchar();
	if (c != '.')return y;
	c = getchar();
	while (isnum(c))y = y + (toC(c)) / i, i = (i << 1) + (i << 3), c = getchar();
	return y*s;
}

int dx[] = { 1, -1, 0, 0, 1, 1, -1, -1 };
int dy[] = { 0, 0, 1, -1, -1, 1, -1, 1 };
map<string, int>cont;
int main()
{
	fast;
	int n, m;
	si2(n, m);
	string s1;
	si(s1);
	cont[s1] = 1;
	rep(i, 0, m)
	{
		rep(j, 0, n - 1)
		{
			if (s1[j] == '4' && s1[j + 1]=='7')
			{
				if (j % 2==0)
					s1[j + 1] = '4';
				else
					s1[j] = '7';
				if (cont[s1])break;
			}
		}
	}
	cout << s1 << endl;
	return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <set>
#include <map>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <cstdio>
#include <vector>
#include <cctype>
#include <climits>
#include <sstream>
#include <cstdlib>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

#define fast ios_base::sync_with_stdio(false)

#define si(a) cin>>a
#define si2(a,b) cin>>a>>b
#define si3(a,b,c) cin>>a>>b>>c

#define read freopen("in.in","r",stdin)
#define write freopen("out.in","w",stdout)

#define rep(i,a,b) for(int i=a;i<b;++i)
#define rep_(i,a,b) for(int i=a;i>=b;--i)
#define wh(t) while(t--)

#define Set(a,b) memset(a,b,sizeof a)
#define Vset(a,b,c) a.resize(b,c)
#define clr(a) a.clear()
#define Sz(a) a.size()
#define Arrsz(a) sizeof a / sizeof a[0]
#define All(a) (a.begin(),a.end())
#define mp make_pair

#define Bug puts("Bug")
#define Nl puts("");
#define Vi vector
#define pr pair
#define N 9999999999

#define isnum(a) (a>=48 && a<=57)
#define isS(a) (a>='a' && a<='z')
#define isU(a) (a>='A' && a<='Z')
#define toS(a) (isU(a)?a+32:a)
#define toU(a) (isS(a)?a-32:a)
#define toC(a) a&15

typedef long long lli;
typedef unsigned long long llu;
typedef Vi<int> vi;
typedef pr<int, int> pii;
typedef pr<pii, int> piii;
typedef map<int, int>::iterator Mit;
typedef set<lli>::iterator Sit;

int gcd(int a, int b){ return (a == 0) ? b : (b == 0) ? a : gcd(b, a%b); }
int str_div(char *s, int n){ int y = 0, ln = strlen(s); rep(i, 0, ln)y = (y * 10 + (s[i] - 48)) % n; return y; }
int get(){
    int y = 0, s = 1, i = 10;
    char c = getchar();
    while (!isnum(c)){
        if (c == '-')s = -1; c = getchar();
    }
    while (isnum(c))y = (y << 1) + (y << 3) + (toC(c)), c = getchar();
    if (c != '.')return y;
    c = getchar();
    while (isnum(c))y = y + (toC(c)) / i, i = (i << 1) + (i << 3), c = getchar();
    return y*s;
}

int dx[] = { 1, -1, 0, 0, 1, 1, -1, -1 };
int dy[] = { 0, 0, 1, -1, -1, 1, -1, 1 };
int main()
{
    fast; //read;
    int n, m;
    si2(n, m);
    string s1;
    si(s1);
    rep(i, 0, m)
    {
        rep(j, 0, n - 1)
        {
            if (s1[j] == '4' && s1[j + 1]=='7')
            {
                if (j % 2==0)
                    s1[j + 1] = '4';
                else
                    s1[j] = '7';
                break;
            }
        }
    }
    cout << s1 << endl;

    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <set>
#include <map>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <cstdio>
#include <vector>
#include <cctype>
#include <climits>
#include <sstream>
#include <cstdlib>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

#define fast ios_base::sync_with_stdio(false)

#define si(a) cin>>a
#define si2(a,b) cin>>a>>b
#define si3(a,b,c) cin>>a>>b>>c

#define read freopen("in.in","r",stdin)
#define write freopen("out.in","w",stdout)

#define rep(i,a,b) for(int i=a;i<b;++i)
#define rep_(i,a,b) for(int i=a;i>=b;--i)
#define wh(t) while(t--)

#define Set(a,b) memset(a,b,sizeof a)
#define Vset(a,b,c) a.resize(b,c)
#define clr(a) a.clear()
#define Sz(a) a.size()
#define Arrsz(a) sizeof a / sizeof a[0]
#define All(a) (a.begin(),a.end())
#define mp make_pair

#define Bug puts("Bug")
#define Nl puts("");
#define Vi vector
#define pr pair
#define N 9999999999

#define isnum(a) (a>=48 && a<=57)
#define isS(a) (a>='a' && a<='z')
#define isU(a) (a>='A' && a<='Z')
#define toS(a) (isU(a)?a+32:a)
#define toU(a) (isS(a)?a-32:a)
#define toC(a) a&15

typedef long long lli;
typedef unsigned long long llu;
typedef Vi<int> vi;
typedef pr<int, int> pii;
typedef pr<pii, int> piii;
typedef map<int, int>::iterator Mit;
typedef set<lli>::iterator Sit;

int gcd(int a, int b){ return (a == 0) ? b : (b == 0) ? a : gcd(b, a%b); }
int str_div(char *s, int n){ int y = 0, ln = strlen(s); rep(i, 0, ln)y = (y * 10 + (s[i] - 48)) % n; return y; }
int get(){
    int y = 0, s = 1, i = 10;
    char c = getchar();
    while (!isnum(c)){
        if (c == '-')s = -1; c = getchar();
    }
    while (isnum(c))y = (y << 1) + (y << 3) + (toC(c)), c = getchar();
    if (c != '.')return y;
    c = getchar();
    while (isnum(c))y = y + (toC(c)) / i, i = (i << 1) + (i << 3), c = getchar();
    return y*s;
}

int dx[] = { 1, -1, 0, 0, 1, 1, -1, -1 };
int dy[] = { 0, 0, 1, -1, -1, 1, -1, 1 };
int main()
{
    fast;
    int n, m;
    si2(n, m);
    string s1;
    si(s1);
    while (m)
    {
        rep(i, 0, n - 1)
        {
            if (s1[i] == '4' && s1[i + 1] == '7')
            {
                --m;
                if (i % 2)
                    s1[i] = s1[i + 1] = '7';
                else
                    s1[i] = s1[i + 1] = '4';

                break;
            }
        }
        cout << s1 << endl;
    }
    return 0;
}


#define _CRT_SECURE_NO_WARNINGS
#include <set>
#include <map>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <cstdio>
#include <vector>
#include <cctype>
#include <climits>
#include <sstream>
#include <cstdlib>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

#define fast ios_base::sync_with_stdio(false)

#define si(a) cin>>a
#define si2(a,b) cin>>a>>b
#define si3(a,b,c) cin>>a>>b>>c

#define read freopen("in.in","r",stdin)
#define write freopen("out.in","w",stdout)

#define rep(i,a,b) for(int i=a;i<b;++i)
#define rep_(i,a,b) for(int i=a;i>=b;--i)
#define wh(t) while(t--)

#define Set(a,b) memset(a,b,sizeof a)
#define Vset(a,b,c) a.resize(b,c)
#define clr(a) a.clear()
#define Sz(a) a.size()
#define Arrsz(a) sizeof a / sizeof a[0]
#define All(a) (a.begin(),a.end())
#define mp make_pair

#define Bug puts("Bug")
#define Nl puts("");
#define Vi vector
#define pr pair
#define N 9999999999

#define isnum(a) (a>=48 && a<=57)
#define isS(a) (a>='a' && a<='z')
#define isU(a) (a>='A' && a<='Z')
#define toS(a) (isU(a)?a+32:a)
#define toU(a) (isS(a)?a-32:a)
#define toC(a) a&15

typedef long long lli;
typedef unsigned long long llu;
typedef Vi<int> vi;
typedef pr<int, int> pii;
typedef pr<pii, int> piii;
typedef map<int, int>::iterator Mit;
typedef set<lli>::iterator Sit;

int gcd(int a, int b){ return (a == 0) ? b : (b == 0) ? a : gcd(b, a%b); }
int str_div(char *s, int n){ int y = 0, ln = strlen(s); rep(i, 0, ln)y = (y * 10 + (s[i] - 48)) % n; return y; }
int get(){
	int y = 0, s = 1, i = 10;
	char c = getchar();
	while (!isnum(c)){
		if (c == '-')s = -1; c = getchar();
	}
	while (isnum(c))y = (y << 1) + (y << 3) + (toC(c)), c = getchar();
	if (c != '.')return y;
	c = getchar();
	while (isnum(c))y = y + (toC(c)) / i, i = (i << 1) + (i << 3), c = getchar();
	return y*s;
}

int dx[] = { 1, -1, 0, 0, 1, 1, -1, -1 };
int dy[] = { 0, 0, 1, -1, -1, 1, -1, 1 };
int main()
{
	fast;
	int n, m;
	si2(n, m);
	string s1;
	si(s1);
	while (m--)rep(i, 0, n-1){
		if (s1[i] == '4' && s1[i + 1] == '7')
		{
			if (i % 2){
				s1[i] = s1[i + 1] = '7';
			}
			else
				s1[i] = s1[i + 1] = '4';
			break;
		}
	}
	cout << s1 << endl;

	return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <string>
#include <string.h>
#include <sstream>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <math.h>
#include <algorithm>
#include <utility>
#include <assert.h>
#include <time.h>
#include <limits>
#include <fstream>
#include <map>
#define FOR(i,a,b) for (int i=a; i<=b; i++)
#define FORD(i,a,b) for (int i=a; i>=b; i--)
#define INF numeric_limits<int> :: max()
#define p_b push_back
#define m_p make_pair
#define F first
#define S second
#define eps 1e-12

#ifdef WIN32
 #define I64 "%I64d"
 #else
 #define I64 "%lld"
#endif

using namespace std;
int n,k;
char a[100001];

int main()
{
 #ifndef ONLINE_JUDGE
 freopen("input.txt","rt",stdin);
 freopen("output.txt","wt",stdout);
 #endif
 scanf("%d %d\n",&n,&k);
 FOR(i,1,n) scanf("%c",&a[i]);
 for (int i=1; i<n && k>0; i++)
  {
    if (i%2==0)
     {
       if (a[i]=='4' && a[i+1]=='7' && a[i-1]=='4')
       if (k%2==0) a[i]=='7'; break;

     }

    if (a[i]=='4' && a[i+1]=='7')
     {
      if (i%2==0) a[i]='7',a[i+1]='7',i-=2; else a[i]='4',a[i+1]='4',i--;
      k--;
     }

  }

 FOR(i,1,n) cout<<a[i];
 fclose(stdin); fclose(stdout);
return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <string>
#include <string.h>
#include <sstream>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <math.h>
#include <algorithm>
#include <utility>
#include <assert.h>
#include <time.h>
#include <limits>
#include <fstream>
#include <map>
#define FOR(i,a,b) for (int i=a; i<=b; i++)
#define FORD(i,a,b) for (int i=a; i>=b; i--)
#define INF numeric_limits<int> :: max()
#define p_b push_back
#define m_p make_pair
#define F first
#define S second
#define eps 1e-12

#ifdef WIN32
 #define I64 "%I64d"
 #else
 #define I64 "%lld"
#endif

using namespace std;
int n,k,x=0;
char a[100001];

int main()
{
 #ifndef ONLINE_JUDGE
 freopen("input.txt","rt",stdin);
 freopen("output.txt","wt",stdout);
 #endif
 scanf("%d %d\n",&n,&k);
 FOR(i,1,n) scanf("%c",&a[i]);

 for (int i=1; i<n; i++)
  {
    if (a[i]=='4' && a[i+1]=='7')
     {
      if (i%2==0) a[i]='7',a[i+1]='7'; else a[i]='4',a[i+1]='4',i--;
      x++;
     }
    if (x==k) break;
  }

 FOR(i,1,n) cout<<a[i];
 fclose(stdin); fclose(stdout);
return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <string>
#include <string.h>
#include <sstream>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <math.h>
#include <algorithm>
#include <utility>
#include <assert.h>
#include <time.h>
#include <limits>
#include <fstream>
#include <map>
#define FOR(i,a,b) for (int i=a; i<=b; i++)
#define FORD(i,a,b) for (int i=a; i>=b; i--)
#define INF numeric_limits<int> :: max()
#define p_b push_back
#define m_p make_pair
#define F first
#define S second
#define eps 1e-12

#ifdef WIN32
 #define I64 "%I64d"
 #else
 #define I64 "%lld"
#endif

using namespace std;
int n,k;
char a[100001];

int main()
{
 #ifndef ONLINE_JUDGE
 freopen("input.txt","rt",stdin);
 freopen("output.txt","wt",stdout);
 #endif
 scanf("%d %d\n",&n,&k);
 FOR(i,1,n) scanf("%c",&a[i]);
// if (k>10000000)
// if (k%2==0) k/=2; else k=k/2+1;
 for (int i=1; i<n && k>0; i++)
  {
    if (a[i]=='4' && a[i+1]=='7')
     {
      if (i%2==0) a[i]='7',a[i+1]='7',i-=2; else a[i]='4',a[i+1]='4',i--;
      --k;
     }
     if (a[i]=='4' && (a[i+1]=='4' || a[i+1]=='7') && a[i+2]=='7') break;
  }

 FOR(i,1,n) cout<<a[i];
 fclose(stdin); fclose(stdout);
return 0;
}


#include<iostream>
#include<utility>
#include<cmath>
#include<math.h>
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<fstream>
#include<string>
#include<string.h>
#include<sstream>
#include<limits>
#include<map>
#include<assert.h>
#define L length()
#define eps 1e-12
#define F first
#define S second
#define inf numeric_limits<int> :: max()
#define For(i,a,b) for(int i=a;i<=b;i++)
#define FOR(i,a,b) for(int i=a;i>=b;i--)
using namespace std;
  int n,k;
  string d;

int main()
{
 #ifndef ONLINE_JUDGE
  freopen("input.txt","rt",stdin);
  freopen("output.txt","wt",stdout);
 #endif

  scanf("%d %d\n",&n,&k);
  getline(cin,d);
  for(int i=0;i<n && k>0;++i)
   {
    if (i%2==0 && d[i]=='4' && i<n-2 && (d[i+1]=='4' || d[i+1]=='7') && d[i+2]=='7')
     {
      if (k%2)
       {
        d[i+1]=d[i+1]=='4' ? '7' : '4';
       }
      k=0;
     }  else if (d[i]=='4' && i<n-1 && d[i+1]=='7')
      {
       if (i%2!=0)
        {
         d[i]='7';
        } else { d[i+1]='4'; }
        --k;
      }
   }
  cout<<d;

 fclose(stdin);fclose(stdout);
 return 0;
}


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <string>
#include <string.h>
#include <sstream>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <math.h>
#include <algorithm>
#include <utility>
#include <assert.h>
#include <time.h>
#include <limits>
#include <fstream>
#include <map>
#define FOR(i,a,b) for (int i=a; i<=b; i++)
#define FORD(i,a,b) for (int i=a; i>=b; i--)
#define INF numeric_limits<int> :: max()
#define p_b push_back
#define m_p make_pair
#define F first
#define S second
#define eps 1e-12

#ifdef WIN32
 #define I64 "%I64d"
 #else
 #define I64 "%lld"
#endif

using namespace std;
int n,k,x=0;
char a[100001];

int main()
{
 #ifndef ONLINE_JUDGE
 freopen("input.txt","rt",stdin);
 freopen("output.txt","wt",stdout);
 #endif
 scanf("%d %d\n",&n,&k);
 FOR(i,1,n) scanf("%c",&a[i]);

 for (int i=1; i<n; i++)
  {
    if (a[i]=='4' && a[i+1]=='7')
     {
      if (i%2==0) a[i]='7',a[i+1]='7',i-=2; else a[i]='4',a[i+1]='4',i--;
      x++;
     }
    if (x==k) break;
  }

 FOR(i,1,n) cout<<a[i];
 fclose(stdin); fclose(stdout);
return 0;
}