Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let a = gets();
- a=a.split('');
- let fin=0;
- if (a[0]==0||a[1]==0||a[2]==0) {
- a.sort(function(a, b){return a - b});
- if (a[1]*a[2]<=Number(a[1])+Number(a[2])) {
- fin =Number(a[1])+Number(a[2]);
- }
- else{fin=Number(a[1])*Number(a[2])}
- }
- if (a[0]!=0&&a[1]!=0&&a[2]!=0) {
- a.sort(function(a, b){return a - b});
- if (a[0]==1) {
- fin=Number(a[0])+Number(a[1])*Number(a[2]);
- }
- else{fin=Number(a[0])*Number(a[1])*Number(a[2]);}
- }
- if (a[0]==1&&a[1]==1&&a[2]==1) {
- fin=3;
- }
- print(fin);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement