var now longint beginassign input input txt reset input assign output

1
var n, x, y, i, j, l, r, now : longint;beginassign(input, 'input.txt'); reset(input);assign(output, 'output.txt'); rewrite(output);read(n,i,j);if i<j then x:=i else x:=j;if i>j then y:=i else y:=j;l:=0; r:=(n-1)*y;while l<>r dobeginnow:=(l+r)div 2;j:=now div x + now div y;if j<n-1 then l:=now+1 else r:=nowend;write(r+x);close(output)end.