jiahuimbzuai/CoQuIR huggingface dataset:
//  [rust]
fn main() {
    let h: usize = read();
    let w: usize = read();
    let mut s: Vec<String> = Vec::new();
    for _i in 0..h {
        s.push(read());
    }

    for _i in 0..w + 2 {
        print!("#");
    }
    println!();
    for i in 0..h {
        print!("#");
        print!("{}", s[i]);
        print!("#");
        println!();
    }
    for _i in 0..w + 2 {
        print!("#");
    }
    println!();
}

// 以下関数

use std::io::*;
use std::str::FromStr;
pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

pub const MOD: u64 = 1_000_000_007;

pub fn is_prime(n: i32) -> bool {
    if n < 2 {
        return false;
    } else if n == 2 {
        return true;
    }
    let mut i = 2;
    while i * i < n {
        if n % i == 0 {
            return false;
        } else {
            i += 1;
            continue;
        }
    }
    true
}

pub fn lcm(mut n: i32, mut m: i32) -> i32 {
    n = if n > m { m } else { n };
    m = if n > m { n } else { m };
    let mut i = n;
    while i % m != 0 {
        i += n;
    }
    i
}

pub fn abs(n: i32) -> i32 {
    if n >= 0 {
        n
    } else {
        -n
    }
}

pub fn max(n: i32, m: i32) -> i32 {
    if n >= m {
        n
    } else {
        m
    }
}

pub fn min(n: i32, m: i32) -> i32 {
    if n <= m {
        n
    } else {
        m
    }
}

pub fn factorial(n: u32) -> u32 {
    if n == 0 {
        return 1;
    }
    let mut r = n;
    for i in 0..n - 1 {
        r *= n - i - 1;
    }
    r
}

pub fn combination(n: u32, m: u32) -> u32 {
    factorial(n) / factorial(m) / factorial(n - m)
}
//  [rust]
use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {h: usize, w: usize, a: [String; h]};

    let mut t = 0;
    while w + 1 > t {
        print!("#");
        t += 1;
    }
    println!("#");
    for a_iter in a.iter() {
        println!("#{}#", a_iter);
    }
    let mut u = 0;
    while w + 1 > u {
        print!("#");
        u += 1;
    }
    println!("#");
}
//  [swift]
import Foundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
func exponentiate(_ lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    var count: Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
}
//extension Array where Element == String {
//    func joined(separator separator: String) -> String {
//        return self.joinWithSeparator(separator)
//    }
//}
extension Array where Element: Comparable {
    func max() -> Element {
        return self.maxElement()!
    }
    func min() -> Element {
        return self.minElement()!
    }
    func sorted() -> Array {
        return self.sort()
    }
    func reversed() -> Array {
        return self.reverse()
    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
func exponentiate(lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}

/*************** テストスペース ***************/



/*************** メインプログラム ***************/

let input = readIntSplit(by: " ")
let (H, W) = (input[0], input[1])
var line = [String]()
for _ in 0..<H {
    line += [readLine()!]
}

print((0..<W+2).map{_ in "#"}.joinWithSeparator(""))
for i in 0..<H {
    print("#\(line[i])#")
}
print((0..<W+2).map{_ in "#"}.joinWithSeparator(""))
//  [swift]
import Foundation
func toTuple<T>(_ args: [T]) -> (T, T) { (args[0], args[1]) }
func readInts() -> [Int] { readLine()!.split(separator: " ").map { Int($0)! } }

let (h, w) = toTuple(readInts())
var ai: [String] = []
for _ in 0..<h {
  ai.append(readLine()!)
}
var line = ""
for _ in 0..<w+2 {
  line += "#"
}
print(line)
for a in ai {
  print("#\(a)#")
}
print(line)
//  [swift]
import Foundation

extension String {
    var argi: [Int] { return self.characters.split(" ").map { Int(String($0))! } }
}

let arr = readLine()!.argi

let h: Int = arr[0]
var w: Int = arr[1]

w += 2

var res: String = ""

for i in 0..<w {
    res += "#"
}
res += "\n"

for i in 0..<h {
    let input = readLine()
    res += "#" + input! + "#\n"
}

for i in 0..<w {
    res += "#"
}
res += "\n"

print(res)
//  [typescript]
"use strict";
const Main = (input) =>{
   let xs = input.trim().split('\n');
   let H = Number(xs[0].split(' ')[0]);
   let W = Number(xs[0].split(' ')[1]);
   let a = xs.slice(1);
  
   console.log(Array(W+3).join("#"));
   for(let i=0; i<H; i++){
      console.log('#'+a[i]+'#')
   }
   console.log(Array(W+3).join("#"));
}
Main(require('fs').readFileSync('/dev/stdin','utf8'));
//  [typescript]
const t={input:require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/),n:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.n())}return a}else{const a=t.input[0];t.input.shift();return Number(a)}},s:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.s())}return a}else{const a=t.input[0];t.input.shift();return String(a)}},c:(arg:number=0):any=>{if(arg){const a=[];for(let i=0;i<arg;i++){a.push(t.c())}return a}else{let a=t.input[0].split('');const b=a[0];a.shift();if(a.length>0){t.input[0]=a.join('')}else{t.input.shift()}return String(b)}},o:(...arg)=>{console.log(...arg)},abs:(a)=>{return Math.abs(a)},min:(...a)=>{return Math.min(...a)},max:(...a)=>{return Math.max(...a)},floor:(a)=>{return Math.floor(a)},asc:(ar:number[])=>{return ar.sort((a,b)=>{return a-b})},desc:(ar:number[])=>{return ar.sort((a,b)=>{return b-a})},sw:(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length;i+=2){if(eval(a+op+arr[i]))return arr[i+1];}return arr[arr.length-1]}};
const main=()=>{
  let [h,w]=t.n(2)
  let row=''
  for(let i=0;i<w+2;i++) row+='#'
  t.o(row)
  for(let i=0;i<h;i++) t.o('#'+t.s()+'#')
  t.o(row)
}
main()
//  [typescript]
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const [, W] = input[0].map(Number);
  const image = input.slice(1, -1).map((line) => line[0]);

  return [
    "#".repeat(W + 2),
    ...image.map((line) => `#${line}#`),
    "#".repeat(W + 2),
  ].join("\n");
};

console.log(main(read()));
//  [python]
s = input()
print(s+'es' if s[-1]=='s' else s+'s')
//  [python]
a = input()
if a[len(a)-1] == "s":
    print(a + "es")
else:
    print(a + "s")
//  [python]
s = list(input())
if s[len(s)-1] == 's':
    s.append('es')
else:
    s.append('s')
s = ''.join(s)
print(s)
//  [python]
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from fractions import Fraction
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations, accumulate
from operator import add, mul, sub, itemgetter, attrgetter


import sys
# sys.setrecursionlimit(10**6)
# readline = sys.stdin.buffer.readline
readline = sys.stdin.readline

INF = 1 << 60


def read_int():
    return int(readline())


def read_int_n():
    return list(map(int, readline().split()))


def read_float():
    return float(readline())


def read_float_n():
    return list(map(float, readline().split()))


def read_str():
    return readline().strip()


def read_str_n():
    return readline().strip().split()


def ep(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.perf_counter()
        ret = f(*args, **kwargs)
        e = time.perf_counter()

        ep(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(S):
    return S + ('es' if S[-1] == 's' else 's')


def main():
    S = read_str()
    print(slv(S))


if __name__ == '__main__':
    main()
//  [python]
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from math import gcd
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gcd
from operator import mul
from functools import reduce


sys.setrecursionlimit(2147483647)
INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().rstrip().split()
def S(): return sys.stdin.readline().rstrip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]

mod=10**9+7


s=S()
if s[-1]=="s":
    s+="es"
else:
    s+="s"
print(s)
//  [java]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

    private static Scanner sc;

    public static void main(String[] args) {
        Main instance = new Main();
        sc = instance.new Scanner();
        instance.solve();
    }

    private void solve() {
        try {
            String S = sc.next();
        	System.out.println(S+(S.charAt(S.length()-1)=='s'?"es":"s"));
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    private class Scanner {
        String[] s;
        int i;
        BufferedReader br;
        String regex = " ";

        public Scanner() {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        @Override
        protected void finalize() throws Throwable {
            try {
                super.finalize();
            } finally {
                destruction();
            }
        }

        private void destruction() throws IOException {
            if (br != null) br.close();
        }

        public String next() throws IOException {
            if (i < s.length) return s[i++];
            String st = br.readLine();
            while (st == "") st = br.readLine();
            s = st.split(regex, 0);
            i = 0;
            return s[i++];
        }

        public int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(next());
        }

        public Long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(next());
        }

        public Double nextDouble() throws NumberFormatException, IOException {
            return Double.parseDouble(next());
        }
    }
}
//  [java]
//package atcoder.beginner179;

import java.io.*;
import java.util.*;

public class Main {
    static InputReader in;
    static PrintWriter out;

    public static void main(String[] args) {
        //initReaderPrinter(true);
        initReaderPrinter(false);
        //solve(in.nextInt());
        solve(1);        
    }

    static void solve(int testCnt) {
        for (int testNumber = 0; testNumber < testCnt; testNumber++) {
            String s = in.next();
            if(s.charAt(s.length() - 1) == 's') {
                out.println(s + "es");
            }
            else {
                out.println(s + "s");
            }
        }
        out.close();
    }

    static void initReaderPrinter(boolean test) {
        if (test) {
            try {
                in = new InputReader(new FileInputStream("src/input.in"));
                out = new PrintWriter(new FileOutputStream("src/output.out"));
            } catch (IOException e) {
                e.printStackTrace();
            }
        } else {
            in = new InputReader(System.in);
            out = new PrintWriter(System.out);
        }
    }

    static class InputReader {
        BufferedReader br;
        StringTokenizer st;

        InputReader(InputStream stream) {
            try {
                br = new BufferedReader(new InputStreamReader(stream), 32768);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

        Integer[] nextIntArray(int n) {
            Integer[] a = new Integer[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextInt();
            }
            return a;
        }

        Long[] nextLongArray(int n) {
            Long[] a = new Long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextLong();
            }
            return a;
        }
    }
}
//  [java]
import  java.util.Scanner;
        public   class Main {
               public static void main(String[] args) {
                   Scanner scan = new Scanner(System.in);
                   String S;
                   S = scan.nextLine();
                   if (S.charAt(S.length() - 1) == 's') System.out.println(S + "es");
                   else System.out.println(S + "s");
               }
           }
//  [java]
import java.util.Scanner;

public class Main {

    public static final int MOD = 1000000007;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        if (s.charAt(s.length() - 1) == 's') {
            System.out.println(s + "es");
        } else {
            System.out.println(s + "s");
        }

    }
}
//  [java]
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.nextLine();
    if (S.charAt(S.length()-1) == 's') {
      System.out.println(S + "es");
    } else {
      System.out.println(S + "s");
    }
  }
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

template<typename T> T chmax(T& a, const T& b){return a = (a > b ? a : b);}
template<typename T> T chmin(T& a, const T& b){return a = (a < b ? a : b);}

int main(){
    string s;
    cin >> s;
    if(s.back()== 's') s+= 'e';
    s += 's';
    cout << s << '\n';
    return 0;
}
//  [cpp]
#include <iostream>

int main(void) {
    std::string S;
    int length;
    
    std::cin >> S;
    
    length = S.size();
    
    if(S[length-1] == 's') {
        std::cout << S << "es" << std::endl;
    } else {
        std::cout << S << "s" << std::endl;
    }
    
    return 0;
}
//  [cpp]
#include <cstdio>
const int Maxn=1000;
char s[Maxn+5];
int main(){
	int n=0;
	scanf("%s",s+1);
	while(s[++n]!='\0');
	n--;
	if(s[n]=='s'){
		n+=2;
		s[n-1]='e';
		s[n]='s';
	}
	else{
		n++;
		s[n]='s';
	}
	puts(s+1);
	return 0;
}
//  [cpp]
#include <bits/stdc++.h>
#include <boost/foreach.hpp>
using namespace std;
#define pi 2*asin(1.0)
#define MAX 10000000
#define MOD 1000000007
#define _GLIBCXX_DEBUG
 
vector<long> fac(MAX);
vector<long> finv(MAX);
vector<long> inv(MAX);
vector<long> Primelist;
//template functions
/////////////////////////
void Prinit(){
long PR=10000001;
vector<long> P(PR,0);
for(long i=2;i*i<PR;i++){
    if(P.at(i)==0){
        long j=i;
      j+=i;
        while(j<PR){
            P.at(j)=1;
             j+=i;         
        }
    }
}

for(long i=2;i*i<PR;i++){//Primelist.size()=446
    if(P.at(i)==0){
        Primelist.push_back(i);
    }
}
}

void Cominit(){
  fac.at(0)=fac.at(1)=1;
  finv.at(0)=finv.at(1)=1;
  inv.at(1)=1;
  for(long i=2;i<MAX;i++){
      fac.at(i)=(fac.at(i-1)*i)%MOD;
      inv.at(i)=MOD-inv.at(MOD%i)*(MOD/i)%MOD;
      finv.at(i)=finv.at(i-1)*inv.at(i)%MOD;
  }
}

long facComb(long N,long M){// nCm%
if(N<M) return 0;
if(N<0||M<0) return 0;
return fac.at(N)*(finv.at(M)*finv.at(N-M)%MOD)%MOD;
}

long Comb(long N,long M){// nCm
long ans=1;
for(long i=N;i>N-M;i--){
    ans=ans*i;
}
for(long i=M;i>0;i--){
    ans=ans/i;
}
return ans;
}

long Perm(long N,long M){// nPm
long ans=1;
for(long i=N;i>N-M;i--){
    ans=ans*i;
}
return ans;
}

long GCM(long A,long B){
            long W,r;
    if(A<B){

        W=B;
        B=A;
        A=W;
    }
    while(A%B!=0){
        r=A%B;
        A=B;
        B=r;
    }
    return B;
}
long LCM(long A,long B){
    return (A*B)/GCM(A,B);
}

long upDiv(long a,long b){
  return (a+b-1)/b;
}

long strtolong(string str){
istringstream ss;
ss=istringstream(str);
long num;
ss>>num;
return num;
}

long chartolong(char ch){
long num;
num=ch-'0';
return num;
}

long Max2(long a,long b){
if(a>b){
    return a;
}else{
    return b;
}
}

long Min2(long a,long b){
if(a>b){
    return b;
}else{
    return a;
}
}


string longtostr(long N){
    string str;
    str=to_string(N);
    return str;
}









/////////////////////////


//Answer


int main() {
string S,T;
cin>>S;
if(S.at(S.size()-1)=='s'){
    T=S+"es";
}else{
    T=S+"s";
}
cout<<T<<endl;
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long
#define all(sdk) sdk.begin(),sdk.end()
#define mll map<ll, ll>
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define repd(i,a,b) for(ll i=a;i>=b;--i)
//#define mp make_pair
#define hell 1000000007
#define endl '\n'
#define vvll vector<vector<int> >
#define vll vector<int>
#define mint map<int,int>
#define sz(x) (int)x.size()
#define sll set<int>
#define pll pair<int,int>
#define F first
#define S second
#define INF 1e18
#define inf 1e10
#define NINF -1e16

#define N 1000005
int spf[N];
vll primes,prev[N],next[N];
set<int>s;
void sieve()
{
	rep(i,2,N)
	{
		if (spf[i]==0)
		{
			spf[i]=i;
			for(int j=2*i;j<=N;j+=i)
			{
				if(spf[j]==0)
					spf[j]=i;
			}
		}
	}
}
void SieveOfEratosthenes(int n) 
{ 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        if (prime[p] == true) 
        { 
            for (int i=p*2; i<=n; i += p) 
                prime[i] = false; 
        } 
    }
    for (int p=2; p<=n; p++) 
    {
        if (prime[p]) 
        {
            primes.pb(p); 
            s.insert(p);
        }
    }    
} 
// bool isPrime(ll n) 
// { 
//     if (n <= 1) 
//         return false; 
//     if (n <= 3) 
//         return true; 
//     if (n % 2 == 0 || n % 3 == 0) 
//         return false; 
//     for (int i = 5; i * i <= n; i = i + 6) 
//         if (n % i == 0 || n % (i + 2) == 0) 
//             return false; 
//     return true; 
// } 
// ll power(ll x,ll y)
// {
//     ll X=x;
//     //X=X%p;//if x is greater than p
//     if(X==0)
//     {
//         return 0;
//     }
//     ll res=1ll;
//     while(y>0)
//     {
//         if(y&1)
//         {
//             res=((res)*(X));
//             y--;
//         }
//         y=y>>1;
//         X=((X)*(X));
//     }
//     // res=(res>=0)?(res%p):(res+p)%p;
//     return(res);
// }
// void dfs(int u, int par){
//     cnt[u] = 1;
//     p[u] = par;
//     for(int i : g[u]){
//         if(i != par){
//             dfs(i,u);
//             cnt[u] += cnt[i];
//         }
//     }
// }
// int children(vll v[],int parent,int src,vll& chil)
// {
// 	int ans =0;
// 	for(auto it:v[src])
// 	{
// 		if(it!=parent)
// 		{
// 			ans+= 1+children(v,src,it,chil);
// 		}
// 	}
// 	chil[src] = ans;
// 	return ans;
 
// }
bool cmp(const pair<int,int>&a,const pair<int,int>&b)
{
    if (a.F==b.F)
    return a.S<b.S;
    else
    return a.F>b.F;
}
signed main() {
	//freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	srand (static_cast <unsigned> (time(0)));
	SieveOfEratosthenes(1000005); 
// 	sort(all(primes));
    sieve();
	int t=1;
	//cin >> t;
	while (t--) 
	{
	    string s;
	    cin >> s;
	    if (s[sz(s)-1]=='s')
	    cout << s <<"es";
	    else
	    cout <<s<<"s";
	}
	return 0;
}
//  [c]
#include <stdio.h>
#include <string.h>

int main()
{   char me[10000];
   
 gets(me);
   
 if((me[(strlen(me)-1)])!='s')
    {
        printf("%ss\n", me);
    }
    else 

if((me[(strlen(me)-1)])=='s')
    {
        printf("%ses\n", me);
    }


    return 0;
}
//  [c]
#include<stdio.h>
#include<string.h>
int main(void){
    int unused __attribute__((unused));
    char name[1001];
    unused = scanf("%s", name);
    int length = strlen(name) - 1;
    char l = name[length];
    if(l != 's'){
        name[length + 1] = 's';
        name[length + 2] = '\0';
    }
    else if(l == 's'){
        name[length + 1] = 'e';
        name[length + 2] = 's';
        name[length + 3] = '\0';
    }
    printf("%s", name);
    x:
    return 0;
}
//  [c]
#include<stdio.h>
#include<string.h>
int main()
{
    int i=0;
    char s[10000];
        scanf("%s",&s);
        i=strlen(s);
        for(i=i-1;i>=0;i--)
        {
            if(s[i]=='s')
            {
                s[i+3]=s[i+1];s[i+1]='e';s[i+2]='s';break;
            }
            else
            {
                s[i+2]=s[i+1];s[i+1]='s';break;
            }
        }
        printf("%s\n",s);
    return 0;
}
//  [c]
#include <stdio.h>
#include <string.h>

int main(void)
{
	char buf[1005];
	int len;

	if (fgets(buf, sizeof(buf), stdin) == NULL)
      return (-1);
	len = strlen(buf);
	len--;
	if (buf[len - 1] == 's')
	{
		buf[len] = 'e';
		buf[len + 1] = 's';
		buf[len + 2] = '\0';
	}
	else
	{
		buf[len] = 's';
		buf[len + 1] = '\0';
	}
	printf("%s\n", buf);
	return (0);
}
//  [c]
//header file
#include <assert.h>
#include <complex.h>
#include <ctype.h>
#include <errno.h>
#include <fenv.h>
#include <float.h>
#include <inttypes.h>
#include <iso646.h>
#include <limits.h>
#include <locale.h>
#include <math.h>
#include <setjmp.h>
#include <signal.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <tgmath.h>
#include <time.h>
#include <wchar.h>
#include <wctype.h>

//type
typedef unsigned long long int uint64_g;
typedef long long int int64_g;
typedef unsigned long int uint32_g;
typedef long int int32_g;
typedef uint_fast64_t uint64;
typedef int_fast64_t int64;
typedef uint_fast32_t uint32;
typedef int_fast32_t int32;

//macro
#define PI M_PI
#define MOD 1000000007

//array
typedef struct {
    struct vectoruint64 *_prev_;
    uint64_g value;
    struct vectoruint64 *_next_;
    uint64_g _indices_;
} vectorUint64;

//print
void print_llu(uint64_g v) { printf("%llu\n", v); }

void print_lu(uint32_g v) { printf("%lu\n", v); }

void print_lli(int64_g v) { printf("%lld\n", v); }

void print_li(int32_g v) { printf("%ld\n", v); }

void print_string(char *v) { printf("%s\n", v); }

void print_int(int v) { printf("%d\n", v); }

void print_double(double v) { printf("%lf\n", v); }

#define print(v) _Generic((v)   \
    , uint64_g : print_llu      \
    , uint32_g : print_lu       \
    , int64_g  : print_lli      \
    , int32_g  : print_li       \
    , char *   : print_string   \
    , int      : print_int      \
    , double   : print_double   \
    , default  : print_double   \
)(v);

//gcd


//temp function


int main(int argc, char *argv[]) {
    char string[1010];
    char character = '\0';
    uint64 i = 0;
    scanf("%s", string);
    while (true){
        if(string[i] == '\0') break;
        character = string[i];
        i++;
    }
    if (character != 's'){
        string[i]='s';
        string[i+1]='\0';
    }else{
        string[i]='e';
        string[i+1]='s';
        string[i+2]='\0';
    }
    print(string)
    return 0;
}
//  [c]
#include <stdio.h>
#include<string.h>
int main()
{
   char s[1002];
   scanf("%s",s);
   if(s[strlen(s)-1]=='s')
   strcat(s,"es");
   else
      strcat(s, "s");


   //printf("%d",strlen(s));
   printf("%s",s);

}
//  [javascript]
const main = stdin => {
  const input = stdin.trim().split('\n')
  const S = input[0]
  console.log(S[S.length - 1] === 's' ? S + 'es' : S + 's');
}


// 標準入力
main(require("fs").readFileSync("/dev/stdin", "utf8"))
//  [javascript]
function Main(input) {
    const inputs = input.split('\n');
    input = inputs[0];
  
	var end = input.substr(-1, 1);
    if (end === "s"){
      console.log( input + "es");
    }else{
      console.log( input + "s");
    }
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
"use strict";
    
const main = arg => {
    arg = arg.trim().split("\n");
    const S = (arg[0].split(" ")[0]);
    
    console.log(S.slice(-1) == "s" ? S + "es" : S + "s");
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [javascript]

function Main(input) {
    input = input.trim().split("\n").map(function(x) { return x.split(" ")});
    let S = input[0][0];
    if (S[S.length - 1] == 's') console.log(S + "es");
    else console.log(S + "s");
}



Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
const main = (arg) => {
    const s = arg.split("\n")[0]
    console.log(s[s.length-1]==="s" ? s+"es" : s+"s")

}
main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
// inputに入力データ全体が入る
function Main(input) {
  // 1行目がinput[0], 2行目がinput[1], …に入る
  input = input.split("\n");
  tmp = input[0].split(" ");
  //文字列から10進数に変換するときはparseIntを使います
  var S = tmp[0];
  //出力
  if(S[S.length - 1] == "s") {
    console.log("%s", S + "es");
  } else {
    console.log("%s", S + "s");
  }
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [go]
package main
import "fmt"
import "strings"
import "bufio"
import "os"

var sc = bufio.NewScanner(os.Stdin)

func main() {
var s string

if sc.Scan() {
  s = sc.Text()
}
  if strings.HasSuffix(s, "s"){
    s = s + "es"
  } else{
    s = s + "s"
  }
  fmt.Println(s)
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
)

const (
	initialBufSize = 1e4
	maxBufSize     = 1e8
)

var sc = bufio.NewScanner(os.Stdin)

func init() {
	buf := make([]byte, initialBufSize)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords)
}

func next() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	S := next()
	result := S
	if S[len(S)-1] == 's' {
		result += "es"
	} else {
		result += "s"
	}
	fmt.Println(result)
}
//  [go]
package main

import "fmt"

func main() {
	var s string
	fmt.Scanf("%s", &s)
	if s[len(s)-1] == 's' {
		fmt.Println(s + "es")
	} else {
		fmt.Println(s + "s")
	}

	return
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	scanner := bufio.NewScanner(os.Stdin)

	scanner.Scan()
	s := scanner.Text()
	sEnd := string(s[len(s)-1])

	result := ""
	if sEnd == "s" {
		result = s + "es"
	} else {
		result = s + "s"
	}

	fmt.Println(result)
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func nextFloat64() float64 {
	sc.Scan()
	i, e := strconv.ParseFloat(sc.Text(), 64)
	if e != nil {
		panic(e)
	}
	return i
}

func nextString() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanWords)
	//sc.Buffer(nil, 100000000)

	s := nextString()

	if s[len(s)-1] == 's' {
		s += "es"
	} else {
		s += "s"
	}
	fmt.Println(s)
}
//  [ruby]
s=gets.chomp.split("").map(&:to_s)
if s[-1]=="s"
    s.push("es")
    puts s.join("")
else
    s.push("s")
    puts s.join("")
end
//  [ruby]
S = gets.chomp.to_s
rev = S.reverse!
judge = rev.index("s")
if judge == 0
    puts rev.reverse! + "es"
else
    puts rev.reverse! + "s"
end
//  [ruby]
s = gets.chomp
if s[-1] == 's'
	s += 'es'
else
	s += 's'
end
puts s
//  [ruby]
require 'set'; require 'prime'; require 'pp'
INF=Float::INFINITY; MOD=10**9+7
s = gets.chomp

if s[-1] == 's'
  puts s + 'es'
else
  puts s + 's'
end
//  [ruby]
#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']
require 'prime'

def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

def big(a,b) return (a>b)? a:b end

def small(a,b) return (a<b)? a:b end

#exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby', $0) if !ENV['RUBY_THREAD_VM_STACK_SIZE']
require 'prime'

def inpf() a=gets.chomp.split(" ").map(&:to_f)end

def inps() a=gets.chomp.split(" ")end

def copy(a) Marshal.load(Marshal.dump(a)) end

def kaijo(n,r = 10**9+7)(n < 2)? 1 : (2..n).inject{|memo,u|memo=(memo*u)%r} end

def na(n,d=0) Array.new(n,d)end

def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end

def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end

def inp() a=gets.chomp.split(" ").map(&:to_i)end

def r_up(a, b) (a+b-1)/b end

def sum(a) a.inject(:+) end

def big(a,b) return (a>b)? a:b end

def small(a,b) return (a<b)? a:b end

s = gets.chomp
puts (s[-1] == "s")? s + "es" : s+"s"
//  [ruby]
s=gets.chomp
puts (s[-1] == ?s ? s + 'es' : s + 's')
//  [rust]
use proconio::{fastout, input, marker::Chars};

#[fastout]
fn main() {
    input! {
        mut s: Chars,
    }

    if *s.last().unwrap() == 's' {
        s.push('e');
    }
    s.push('s');

    let ans = s.into_iter().collect::<String>();
    
    println!("{}", ans);
}
//  [rust]
use proconio::*;
use std::*;

fn main() {
    input! {
        s: String,
    }
    let ans = if s.chars().rev().next().unwrap() == 's' {
        s + "es"
    } else {
        s + "s"
    };
    println!("{}", ans);
}
//  [rust]
use proconio::input;
fn main() {
  input! {
  	s: String,
  }
  let last = &s.chars().collect::<Vec<char>>();
  let last = last[last.len() - 1].to_string();
  let mut ans = s;
  if &last == "s" {
    ans.push_str("es");
  } else {
    ans.push_str("s");
  }
  println!("{}", ans);
}
//  [swift]
let s = readLine()!
if s.suffix(1) == "s" {
    print(s + "es")
} else {
    print(s + "s")
}
//  [swift]
var a = readLine()!
var arrayString = Array(a)
var last_element = arrayString.last


if last_element=="s"{
  print(a + "es")
} else{
  print(a + "s")
}
//  [swift]
let input = readLine()!

if input.last == "s" {
    print(input + "es")
} else {
    print(input + "s")
}
//  [swift]
import Foundation
var str = readLine()!
if str.hasSuffix("s") {
    print(str+"es")
}else {
    print(str+"s")
}
//  [swift]
import Foundation
let N = String(readLine()!)
if(N[N.index(before: N.endIndex)] == "s"){
  print(N + "es")
}else{
  print(N + "s")
}
//  [swift]
import Foundation

func main() {
 var s = readLine()!
 let lastStr = String(s.suffix(1))
 
 if(lastStr == "s") {
  s = s + "es"
 } else {
  s = s + "s"
 }
 
 print(s)

}

main()
//  [typescript]
import * as fs from 'fs';
// main
function main(input: string[]) {
    // param
    let s;
    let ans;
    // init
    s = input.shift();
    // solve
    if (s.substring(s.length-1) != "s") {
        ans = s + "s";
    } else {
        ans = s + "es";
    }
    // answer
    console.log(ans);
}
// entrypoint
function entrypoint() {
    try {
        // linux
        let input = fs.readFileSync("/dev/stdin", "utf8").trim().split("\n");
        console.debug = function () { };
        main(input);
    }
    catch (ex) {
        // windows
        const lines: string[] = [];
        // @ts-ignore
        const reader = require('readline').createInterface({
            // @ts-ignore
            input: process.stdin,
            // @ts-ignore
            output: process.stdout
        });
        reader.on('line', function (line: string) {
            lines.push(line);
        });
        reader.on('close', function () {
            let input = lines;
            main(input);
        });
    }
}
entrypoint();
//  [python]
N, M= map(int, input().split())
A = list(map(int, input().split()))

A.sort()
l = -1
r = A[-1] + 1


while r - l > 1:
    m = (r + l) // 2
    mc = 0
    a = 0
    for i in range(N):
        s = A[i]
        while m < s:
            s //= 2
            mc += 1
        a += s
    if mc <= M:
        r = m
        ans = a - (M - mc) * ((m // 2) + m % 2)
    else:
        l = m 
            
print(ans)
//  [python]
import math
import numpy as np

# n, m = 4,4
# a_list = np.array([1,9,3,5])

n,m = map(int, input().split())
a_list = np.array(list(map(int, input().split())))

a_list = np.sort(a_list)

a_logs = np.log2(a_list).astype('int64')

max_num = max(a_logs)
num = max_num*1

count_num = 0
flag = True
while(flag):
    count_num_temp = sum(a_logs>=num) + count_num
    if(count_num_temp > m):
        flag = False
        remain = m - count_num
    else:
        count_num = count_num_temp
        num -= 1
        if(num == -1):
            print('0')
            exit()

a_list = a_list // 2**((a_logs > num) * (a_logs - num))

if(remain > 0):
    a_list = np.sort(a_list)
    a_list[(n-remain):] = a_list[(n-remain):] //2

ans = sum(a_list)
print(ans)
//  [java]
import java.io.*;
import java.math.*;
import java.util.*;
public class Main {

	public static void main(String[] args) { //WOOOOOOO AtCoder is HELPING!!!!!!!!!!
		//Arraylist cheese for the win
		Scanner input = new Scanner(System.in);
		int N = input.nextInt();
		int M = input.nextInt();
		long ans = 0;
		ArrayList<Long> deductions = new ArrayList<Long>();
		for (int i = 0; i < N; i++) {
			long x = input.nextLong();
			ans+=x;
			while (x>0) {
				long sub = x-x/2;
				deductions.add(sub);
				x/=2;
			}
		}
		Collections.sort(deductions);
		int index = deductions.size()-1;
		int cnt = 0;
		while (cnt < M) {
			ans-=deductions.get(index);
			cnt++;
			index--;
			if (index==-1) break;
		}
		System.out.println(ans);
	}
}
//  [java]
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();

        int[] a = new int[n];
        long ans = 0;
        for (int i = 0 ; i < n ; i++) {
            a[i] = sc.nextInt();
            ans += (long) a[i];
        }



        List<Integer> list = new ArrayList<>();
        for (int i = 0 ; i < n ; i++) {
            while (a[i] > 0) {
                list.add(a[i] - a[i]/2);
                a[i] /= 2;
            }
        }

        Collections.sort(list);

        long sum = 0;
        for (int i = 0 ; i < m ; i++) {
            if (i < list.size()) {
                sum += (long) list.get(list.size() - 1 - i);
            }

        }

        System.out.println(ans - sum);

    }

}
//  [cpp]
#include <iostream>
#include <cstdio>
#include <string>
#include <cmath>
#include <cctype>
#include <cstdlib>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
#include <list>
using namespace std;


int main() {
	int n, m,k; long long ans = 0;
	vector<int> a;
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		cin >> k;
		a.push_back(k);
	}
	sort(a.begin(), a.end());
	for (int i = 0; i < m;i++) {
		int v = a[n - 1] / 2;
		int l = 0, r = n - 1;
		while (l<r) {
			int mid = (l + r) / 2;
			if (a[mid] == v) {
				l = r = mid;
			}
			else if (a[mid] > v) r = mid;
			else l = mid + 1;
		}
		a.insert(a.begin() + l, v);
	}
	for (int i = 0; i < n; i++) {
		ans += a[i];
	}
	cout << ans << endl;
}
//  [cpp]
#include<algorithm>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include<vector>

using namespace std;
 
typedef long long ll;

#define PB push_back
#define MP make_pair
#define F first
#define S second

template<typename T,typename U>
bool chmax(T& max, const U& x){
	if(max<x){
		max = x;
		return true;
	}
	return false;
}

template<typename T,typename U>
bool chmin(T& min, const U& x){
	if(min>x){
		min = x;
		return true;
	}
	return false;
}



int main(){
	ll n,m;
  	cin >> n >> m;
  	vector<ll> a(n);
  	for(ll i=0;i<n;i++){
    	cin >> a[i];
    }
  	sort(a.begin(),a.end());
  	ll d;
  	while( (d=distance(lower_bound(a.begin(),a.end(),a.back()/2),a.end())) >=m){
      	if(m<=0) break;
    	for(int i=0;i<min(d,m);i++){
        	a[n-1-i]/=2;	
        }
      	m-=d;
      	sort(a.begin(),a.end());
    }

  	for(ll i=0;i<m;i++){
      	if(a.size()==0) break;
    	ll tmp=a.back()/2;
      	a.pop_back();
      	if(tmp>0){
      		auto itr = lower_bound(a.begin(),a.end(),tmp);
      		a.insert(itr,tmp);
        }
    }
  	ll sum=0;
  	if(a.size()!=0){
  		for(auto &e:a){
    		sum+=e;
    	}
    }
  	cout << sum << endl;
}
//  [cpp]
#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <queue>
#include <cstring>

using namespace std;

#define rep(i,x) for(int i=0;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define FIND(x, target) find(x.begin(),x.end(),target)
#define pb(x) push_back(x)
#define pob(x) pop_back(x)
#define output(x) cout<<x<<endl
#define ERASE(x, n) x.erase(x.begin()+n)
// #define int long long
// #define P pair<int, int>
typedef long long ll;

const long long int MOD = 1e9+7;
const int INF = -1;
ll dp[100005][13];

signed main(void) {
	ll N, M;
	cin >> N >> M;
	vector<vector<double> > A;
	vector<double> tmpA;
	rep(i, N) {
		double tmp;
		cin >> tmp;
		tmpA.pb(tmp);
	}
	A.pb(tmpA);

	sort(A[0].begin(), A[0].end(), greater<double>() );
	// vector<float> R;
	rep(i, M) {
		double maxValue = 0;
		ll maxIndex = 0;
		rep(i, A.size()) {
			if (A[i].size() > 0) {
				if (A[i][0] > maxValue) {
					maxValue = A[i][0];
					maxIndex = i;
				}
			}
		}

		if (maxValue == 0) {
			break;
		}

		ERASE(A[maxIndex], 0);

		maxValue = maxValue/2;
		ll maxtmp = maxValue;
		if(maxtmp == 0) {
			maxValue = 0;
		}

		if (maxIndex == A.size()-1) {
			vector<double> tmpA_;
			tmpA_.pb(maxValue);
			A.pb(tmpA_);
		} else {
			A[maxIndex+1].pb(maxValue);
		}

	}

	ll ans = 0;

	rep(i, A.size()) {
		rep(j, A[i].size()) {
			ll tmp = A[i][j];
			ans += tmp;
		}
	}

	cout << ans << endl;
}
//  [c]
#include<stdio.h>
#include<stdlib.h>
#include<string.h>


struct priority_queue{
	size_t __nmemb;
	size_t __size;
	int (*__compar) (const void*, const void*);
	size_t length;
	void *heap;
	void *temp;
	int (*push)(struct priority_queue*, int);
	int (*pop)(struct priority_queue*);
	void (*clear)(struct priority_queue*);
	void (*dispose)(struct priority_queue*);
};

int priority_queue_push(struct priority_queue *p, int value){
	if(p->length == p->__nmemb){
		return -1;
	}
	void *heap = p->heap - p->__size;
	p->length++;
	memcpy(heap+(p->length*p->__size), (void*)&value, p->__size);

	size_t node;
	for(node=p->length; p->__compar(heap+node*p->__size, heap+(node/2)*p->__size)<0 && node != 1; node/=2){
		memcpy(p->temp, heap+node*p->__size, p->__size);
		memcpy(heap+node*p->__size, heap+(node/2)*p->__size, p->__size);
		memcpy(heap+(node/2)*p->__size, p->temp, p->__size);
	}
	return 0;
}

int priority_queue_pop(struct priority_queue *p){
	if(p->length == 0){
		return 0;
	}
	int ret;
	size_t node, downto;
	size_t left, right;
	char f;
	void *heap = p->heap - p->__size;
	
	ret = *((int*)(heap+p->__size));
	
	memcpy(heap+p->__size, heap+(p->length*p->__size), p->__size);
	p->length--;
	node = 1;
	while(1) {
		downto = node;
		left = node<<1;
		right = left+1;
		if (left<=p->length && p->__compar(heap+downto*p->__size, heap+left*p->__size)>0){
			downto=left;
		}
		if (right<=p->length && p->__compar(heap+downto*p->__size, heap+right*p->__size)>0){
			downto = right;
		}
		if(downto==node){
			break;
		}
		memcpy(p->temp, heap+node*p->__size, p->__size);
		memcpy(heap+node*p->__size, heap+downto*p->__size, p->__size);
		memcpy(heap+downto*p->__size, p->temp, p->__size);
		node = downto;
	}
    return ret;
}

void priority_queue_clear(struct priority_queue *p){;
	p->length = 0;
}

void priority_queue_dispose(struct priority_queue *p){
	free(p->heap);
}

int create_priority_queue(struct priority_queue *p, size_t __nmemb, /*size_t __size, */int (*__compar) (const void*, const void*)){
	size_t __size = sizeof(int);
	if((p->heap = malloc(__nmemb * __size)) == NULL){
		return -1;
	}
	if((p->temp = malloc(__size)) == NULL){
		free(p->heap);
		return -1;
	}
	p->__nmemb = __nmemb;
	p->__size = __size;
	p->__compar = __compar;
	p->length = 0;
	p->push = priority_queue_push;
	p->pop = priority_queue_pop;
	p->clear = priority_queue_clear;
	p->dispose = priority_queue_dispose;
	return 0;
}

int compare_int(const void *a, const void *b){return *(int*)b - *(int*)a;}

struct priority_queue A;
int N, M, a, i;
long sum;

int main(void){
	scanf("%d%d", &N, &M);
	create_priority_queue(&A, N, compare_int);
	for(i=0; i<N; i++){
		scanf("%d", &a);
		sum += a;
		A.push(&A, a);
	}
	for(i=0; i<M; i++){
		a = A.pop(&A);
		sum -= (a+1)>>1;
		A.push(&A, a>>1);
	}
	printf("%ld\n", sum);
}
//  [javascript]
class SkewNode{
  r; l;
  constructor(v){ this.v = v; }
}
class SkewQ {
  constructor(v) {
    this.h = v?new SkewNode(v):void 0;
  }
  static meld(a,b) {
    if ( a === void 0 ) return b;
    if ( b === void 0 ) return a;
    if ( a.v < b.v ) [a,b] = [b,a];
    a.r = SkewQ.meld(a.r,b);
    [a.r,a.l] = [a.l,a.r];
    return a;
  }
  pop(){
    const v = this.h.v;
    this.h = SkewQ.meld(this.h.r,this.h.l);
    return v;
  }
  push(v){
    const b = new SkewNode(v);
    this.h = SkewQ.meld(this.h,b);
  }
}
console.log((args=>{
  const [[N,M],A] = args.trim().split`\n`.map(r=>r.split` `.map(v=>v|0));
  const q = new SkewQ(A[0]);
  for ( let i = 1; i < N; i++ ) q.push(A[i]);
  for ( let i = 0; i < M; i++ ) q.push( q.pop()>>1 );
  let s = 0;
  for ( let i = 0; i < N; i++ ) s += q.pop();
  return s;
})(require('fs').readFileSync('/dev/stdin', 'utf8')));
//  [javascript]
'use strict';

const testcase = null;

function main(input) {
    const n = parseInt(input.shift());
    const m = parseInt(input.shift());
    const b = new BinaryHeap();
    for (var i = 0; i < n; i++) {
        b.push(parseInt(input.shift()));
    }
    for (var i = 0; i < m; i++) {
        b.push(b.pop() / 2);
    }
    var sum = 0;
    for (var i = 0; i < n; i++) {
        sum += Math.trunc(b.pop());
    }
    console.log(sum);
}

class BinaryHeap {
    constructor() {
        // HACK: first is unused
        this.heap = new Array(1);
    }
    push(data) {
        const index = this.heap.push(data) - 1;
        BinaryHeap.upHeap(this.heap, index);
    }
    static upHeap(heap, idx) {
        const parent = Math.trunc(idx / 2);
        if (heap[parent] < heap[idx]) {
            const tmp = heap[idx];
            heap[idx] = heap[parent];
            heap[parent] = tmp;
            BinaryHeap.upHeap(heap, parent);
        }
    }
    pop() {
        const index = 1;
        const data = this.heap[index];
        const last = this.heap.pop();
        if (1 < this.heap.length) {
            this.heap[index] = last;
            BinaryHeap.downHeap(this.heap, index);
        }
        return data;
    }
    static downHeap(heap, idx) {
        const childL = idx * 2, childR = idx * 2 + 1;
        var target = idx;
        target = heap[target] < heap[childL] ? childL : target;
        target = heap[target] < heap[childR] ? childR : target;
        if (target != idx) {
            const tmp = heap[target];
            heap[target] = heap[idx];
            heap[idx] = tmp;
            BinaryHeap.downHeap(heap, target);
        }
    }
}

// as python, if __name__ == '__main__':
if (process.argv[1] == __filename) {
    const input = testcase
        || require('fs')
            .readFileSync('/dev/stdin', 'utf-8');
    main(input.split(/\s/));
}
//  [javascript]
class SkewQ {
  constructor(v,r,l) {
    this.h = {v,r,l};
  }
  static meld(a,b) {
    if ( a === void 0 ) return b;
    if ( b === void 0 ) return a;
    if ( a.v < b.v ) [a,b] = [b,a];
    a.r = SkewQ.meld(a.r,b);
    [a.r,a.l] = [a.l,a.r];
    return a;
  }
  pop(){
    const v = this.h.v;
    this.h = SkewQ.meld(this.h.r,this.h.l);
    return v;
  }
  push(v,r,l){
    const b = {v,r,l};
    this.h = SkewQ.meld(this.h,b);
  }
}
console.log((args=>{
  const [[N,M],A] = args.trim().split`\n`.map(r=>r.split` `.map(v=>v|0));
  const q = new SkewQ(A[0]);
  for ( let i = 1; i < N; i++ ) q.push(A[i]);
  for ( let i = 0; i < M; i++ ) q.push( q.pop()>>1 );
  let s = 0;
  for ( let i = 0; i < N; i++ ) s += q.pop();
  return s;
})(require('fs').readFileSync('/dev/stdin', 'utf8')));
//  [go]
package main
import (
	"bufio"
	"container/heap"
	"fmt"
	"os"
	"strconv"
)
 
var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}
 
func nextInt() int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}
 
func nextInt64() int64 {
	sc.Scan()
	i, _ := strconv.ParseInt(sc.Text(), 10, 64)
	return i
}

type Item struct {
  Price int
}

type PriorityQueue []*Item

func (pq PriorityQueue) Len() int {
  return len(pq)
}

func (pq PriorityQueue) Less(i, j int) bool {
  return pq[j].Price < pq[i].Price
}

func (pq PriorityQueue) Swap(i, j int) {
  pq[i], pq[j] = pq[j], pq[i]
}

func (pq *PriorityQueue) Pop() interface{} {
  old := *pq
  n := len(old)
  item := old[n-1]
  *pq = old[0:n-1]
  return item
}

func (pq *PriorityQueue) Push(x interface{}) {
  item := x.(*Item)
  *pq = append(*pq, item)
}

func main() {
  sc.Buffer(make([]byte, 500000), 500000)
  sc.Split(bufio.ScanWords)
 
  n := nextInt()
  m := nextInt()
  
  as := make([]int, n)
  for i := 0; i < n; i++ {
    as[i] = nextInt()
  }
  priorityQueue := make(PriorityQueue, n, 1000*n)
  for i, a := range as {
    item := Item{}
    item.Price = a
    priorityQueue[i] = &item 
  }
  heap.Init(&priorityQueue)
  
  for i := 0; i < m; i++ {
    item := heap.Pop(&priorityQueue).(*Item)
    newPrice := item.Price/2
    newItem := Item{}
    newItem.Price = newPrice
    heap.Push(&priorityQueue, &newItem)
  }
  result := int64(0)
  for i := 0; i < n; i++ {
    item := heap.Pop(&priorityQueue).(*Item)
    result += int64(item.Price)
  }
  fmt.Println(result)
  
  
}