import strutils proc nextString: string = result = "" while not endOfFile stdin: let nextChar = readChar stdin case nextChar of '\r': discard of "\n"[0], ' ': break else: add result, nextChar proc nextInt: int = return parseInt nextString() proc main: void = var score = 0 var bonus = 1 var pf = nextInt() var gt = nextInt() let gd = nextInt() let ms = nextInt() if ms >= 10: echo("Impossible") return for i in 1..int.high: if gt == 0 and pf == 0: break elif gt != 0: score += 50 * bonus gt -= 1 elif pf != 0: score += 100 * bonus pf -= 1 if i mod 100 == 0: bonus *= 2 echo score when isMainModule: main()