import std.stdio, std.algorithm, std.conv, std.array, std.string; void main() { auto line = readln().strip(); int maxn = line.dup().map!(to!int).reduce!max; long max = 0; foreach(idx; 0..line.length) { if (line[idx].to!int != maxn) continue; dchar[] l = line.dup.to!(dchar[]); auto tmp = l[0]; l[0] = l[idx]; l[idx] = tmp; auto n = l.to!long; if (n > max) { max = n; } } writeln(max); }