import java.util.*; import java.util.stream.*; import static java.lang.Math.*; public class Main{ public static void main(String... args){ Scanner sc=new Scanner(System.in); int n=sc.nextInt(); int total=sc.nextInt(); int[] a=new int[n]; for(int i=0;i=0){ if(dp[i-1][j-a[i]]){ dp[i][j]=true; } } if(j%a[i]==0){ if(dp[i-1][j/a[i]]&&!dp[i][j]){ dp[i][j]=true; } } } } List list=new ArrayList<>(); dfs(total,n-1,"",list,dp,a); Collections.sort(list,Comparator.reverseOrder()); //put(list); put(list.get(0)); } public static void dfs(int current,int index,String string,List list,boolean[][] dp,int[] a){ //put("current:%d,index:%d,string:%s",current,index,string); if(index==0){ if(current==a[0]){ list.add(string); } return; } if(current-a[index]>=0&&dp[index-1][current-a[index]]){ dfs(current-a[index],index-1,"+"+string,list,dp,a); } if(current%a[index]==0&&dp[index-1][current/a[index]]){ dfs(current/a[index],index-1,"*"+string,list,dp,a); } } public static class Pair{ final int x,y; Pair(int x,int y){ this.x=x; this.y=y; } @Override public String toString(){ return String.format("Pair(%d,%d)",x,y); } } public static void print(Object object){ System.out.print(object); } public static void put(Object object) { System.out.println(object); } public static void put(){ System.out.println(); } public static void print(String format,Object... args){ System.out.print(String.format(format,args)); } public static void put(String format,Object... args) { System.out.println(String.format(format,args)); } }