
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    
    
    public static void main(String[] args){
        
        Scanner in = new Scanner(System.in);
        
        int x = in.nextInt();
        
        int y = in.nextInt();
        
        int z = in.nextInt();
        
        int k = in.nextInt();
        
        int x1=x;
        
        int y1=y;
        
        
        int res[]=new int[3];
        
        for(int i=0;i<3;i++){
            
            for(int j=0;j<k;j++){
                
                if(i==0){
                   
                    x=x*2;
                    res[0]=x+y+z;
                   
                }
                
                if(i==1){
                    
                    x=x1;
                    y=y*2;
                    res[1]=x+y+z; 
                }
                
                if(i==2){
                   
                    y=y1;
                    z =z*2;
                    res[2]=x+y+z; 
                    
                }
            }
            
        }
        
        Arrays.sort(res);
        
        System.out.println(res[res.length-1]);
       
       
    }
    
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
    
    
    public static void main(String[] args){
        
        Scanner in = new Scanner(System.in);
        
        int x = in.nextInt();
        
        int y = in.nextInt();
        
        int z = in.nextInt();
        
        int k = in.nextInt();
        
        int x1=x;
        
        int y1=y;
        
        
        int res[]=new int[3];
        
        for(int i=0;i<3;i++){
            
            for(int j=0;j<k;j++){
                
                if(i==0){
                   
                    x=x*2;
                    res[0]=x+y+z;
                   
                }
                
                if(i==1){
                    
                    x=x1;
                    y=y*2;
                    res[1]=x+y+z; 
                }
                
                if(i==2){
                   
                    y=y1;
                    z =z*2;
                    res[2]=x+y+z; 
                    
                }
            }
            
        }
        
        Arrays.sort(res);
        
        System.out.println(res[res.length-1]);
       
       
    }
    
} Main public static void main(String[] args){
        
        Scanner in = new Scanner(System.in);
        
        int x = in.nextInt();
        
        int y = in.nextInt();
        
        int z = in.nextInt();
        
        int k = in.nextInt();
        
        int x1=x;
        
        int y1=y;
        
        
        int res[]=new int[3];
        
        for(int i=0;i<3;i++){
            
            for(int j=0;j<k;j++){
                
                if(i==0){
                   
                    x=x*2;
                    res[0]=x+y+z;
                   
                }
                
                if(i==1){
                    
                    x=x1;
                    y=y*2;
                    res[1]=x+y+z; 
                }
                
                if(i==2){
                   
                    y=y1;
                    z =z*2;
                    res[2]=x+y+z; 
                    
                }
            }
            
        }
        
        Arrays.sort(res);
        
        System.out.println(res[res.length-1]);
       
       
    } main {
        
        Scanner in = new Scanner(System.in);
        
        int x = in.nextInt();
        
        int y = in.nextInt();
        
        int z = in.nextInt();
        
        int k = in.nextInt();
        
        int x1=x;
        
        int y1=y;
        
        
        int res[]=new int[3];
        
        for(int i=0;i<3;i++){
            
            for(int j=0;j<k;j++){
                
                if(i==0){
                   
                    x=x*2;
                    res[0]=x+y+z;
                   
                }
                
                if(i==1){
                    
                    x=x1;
                    y=y*2;
                    res[1]=x+y+z; 
                }
                
                if(i==2){
                   
                    y=y1;
                    z =z*2;
                    res[2]=x+y+z; 
                    
                }
            }
            
        }
        
        Arrays.sort(res);
        
        System.out.println(res[res.length-1]);
       
       
    } Scanner in = new Scanner(System.in); in new Scanner(System.in) int x = in.nextInt(); x in.nextInt() in.nextInt in int y = in.nextInt(); y in.nextInt() in.nextInt in int z = in.nextInt(); z in.nextInt() in.nextInt in int k = in.nextInt(); k in.nextInt() in.nextInt in int x1=x; x1 x int y1=y; y1 y int res[]=new int[3]; res new int[3] 3 for(int i=0;i<3;i++){
            
            for(int j=0;j<k;j++){
                
                if(i==0){
                   
                    x=x*2;
                    res[0]=x+y+z;
                   
                }
                
                if(i==1){
                    
                    x=x1;
                    y=y*2;
                    res[1]=x+y+z; 
                }
                
                if(i==2){
                   
                    y=y1;
                    z =z*2;
                    res[2]=x+y+z; 
                    
                }
            }
            
        } int i=0; int i=0; i 0 i<3 i 3 i++ i++ i {
            
            for(int j=0;j<k;j++){
                
                if(i==0){
                   
                    x=x*2;
                    res[0]=x+y+z;
                   
                }
                
                if(i==1){
                    
                    x=x1;
                    y=y*2;
                    res[1]=x+y+z; 
                }
                
                if(i==2){
                   
                    y=y1;
                    z =z*2;
                    res[2]=x+y+z; 
                    
                }
            }
            
        } {
            
            for(int j=0;j<k;j++){
                
                if(i==0){
                   
                    x=x*2;
                    res[0]=x+y+z;
                   
                }
                
                if(i==1){
                    
                    x=x1;
                    y=y*2;
                    res[1]=x+y+z; 
                }
                
                if(i==2){
                   
                    y=y1;
                    z =z*2;
                    res[2]=x+y+z; 
                    
                }
            }
            
        } for(int j=0;j<k;j++){
                
                if(i==0){
                   
                    x=x*2;
                    res[0]=x+y+z;
                   
                }
                
                if(i==1){
                    
                    x=x1;
                    y=y*2;
                    res[1]=x+y+z; 
                }
                
                if(i==2){
                   
                    y=y1;
                    z =z*2;
                    res[2]=x+y+z; 
                    
                }
            } int j=0; int j=0; j 0 j<k j k j++ j++ j {
                
                if(i==0){
                   
                    x=x*2;
                    res[0]=x+y+z;
                   
                }
                
                if(i==1){
                    
                    x=x1;
                    y=y*2;
                    res[1]=x+y+z; 
                }
                
                if(i==2){
                   
                    y=y1;
                    z =z*2;
                    res[2]=x+y+z; 
                    
                }
            } {
                
                if(i==0){
                   
                    x=x*2;
                    res[0]=x+y+z;
                   
                }
                
                if(i==1){
                    
                    x=x1;
                    y=y*2;
                    res[1]=x+y+z; 
                }
                
                if(i==2){
                   
                    y=y1;
                    z =z*2;
                    res[2]=x+y+z; 
                    
                }
            } if(i==0){
                   
                    x=x*2;
                    res[0]=x+y+z;
                   
                } i==0 i 0 {
                   
                    x=x*2;
                    res[0]=x+y+z;
                   
                } x=x*2 x x*2 x 2 res[0]=x+y+z res[0] res 0 x+y+z x+y+z x y z if(i==1){
                    
                    x=x1;
                    y=y*2;
                    res[1]=x+y+z; 
                } i==1 i 1 {
                    
                    x=x1;
                    y=y*2;
                    res[1]=x+y+z; 
                } x=x1 x x1 y=y*2 y y*2 y 2 res[1]=x+y+z res[1] res 1 x+y+z x+y+z x y z if(i==2){
                   
                    y=y1;
                    z =z*2;
                    res[2]=x+y+z; 
                    
                } i==2 i 2 {
                   
                    y=y1;
                    z =z*2;
                    res[2]=x+y+z; 
                    
                } y=y1 y y1 z =z*2 z z*2 z 2 res[2]=x+y+z res[2] res 2 x+y+z x+y+z x y z Arrays.sort(res) Arrays.sort Arrays res System.out.println(res[res.length-1]) System.out.println System.out System System.out res[res.length-1] res res.length-1 res.length res res.length 1 String[] args args public class Main {
    
    
    public static void main(String[] args){
        
        Scanner in = new Scanner(System.in);
        
        int x = in.nextInt();
        
        int y = in.nextInt();
        
        int z = in.nextInt();
        
        int k = in.nextInt();
        
        int x1=x;
        
        int y1=y;
        
        
        int res[]=new int[3];
        
        for(int i=0;i<3;i++){
            
            for(int j=0;j<k;j++){
                
                if(i==0){
                   
                    x=x*2;
                    res[0]=x+y+z;
                   
                }
                
                if(i==1){
                    
                    x=x1;
                    y=y*2;
                    res[1]=x+y+z; 
                }
                
                if(i==2){
                   
                    y=y1;
                    z =z*2;
                    res[2]=x+y+z; 
                    
                }
            }
            
        }
        
        Arrays.sort(res);
        
        System.out.println(res[res.length-1]);
       
       
    }
    
} public class Main {
    
    
    public static void main(String[] args){
        
        Scanner in = new Scanner(System.in);
        
        int x = in.nextInt();
        
        int y = in.nextInt();
        
        int z = in.nextInt();
        
        int k = in.nextInt();
        
        int x1=x;
        
        int y1=y;
        
        
        int res[]=new int[3];
        
        for(int i=0;i<3;i++){
            
            for(int j=0;j<k;j++){
                
                if(i==0){
                   
                    x=x*2;
                    res[0]=x+y+z;
                   
                }
                
                if(i==1){
                    
                    x=x1;
                    y=y*2;
                    res[1]=x+y+z; 
                }
                
                if(i==2){
                   
                    y=y1;
                    z =z*2;
                    res[2]=x+y+z; 
                    
                }
            }
            
        }
        
        Arrays.sort(res);
        
        System.out.println(res[res.length-1]);
       
       
    }
    
} Main

import java.util.Arrays;
import java.util.Scanner;

public class Main {
    
    
    public static void main(String[] args){
        
        Scanner in = new Scanner(System.in);
        
        int x = in.nextInt();
        
        int y = in.nextInt();
        
        int z = in.nextInt();
        
        int k = in.nextInt();
        
        int x1=x;
        
        int y1=y;
        
        
        int res[]=new int[3];
        
        for(int i=0;i<3;i++){
            
            for(int j=0;j<k;j++){
                
                if(i==0){
                   
                    x=x*2;
                    res[0]=x+y+z;
                   
                }
                
                if(i==1){
                    
                    x=x1;
                    y=y*2;
                    res[1]=x+y+z; 
                }
                
                if(i==2){
                   
                    y=y1;
                    z =z*2;
                    res[2]=x+y+z; 
                    
                }
            }
            
        }
        
        Arrays.sort(res);
        
        System.out.println(res[res.length-1]);
       
       
    }
    
}
