COCI '06 Contest 2 #1 R2

View as PDF

Submit solution

Points: 3
Time limit: 1.0s
Memory limit: 32M

Problem type
Allowed languages
Ada, Assembly, Awk, Brain****, C, C#, C++, COBOL, CommonLisp, D, Dart, F#, Forth, Fortran, Go, Groovy, Haskell, Intercal, Java, JS, Kotlin, Lisp, Lua, Nim, ObjC, OCaml, Octave, Pascal, Perl, PHP, Pike, Prolog, Python, Racket, Ruby, Rust, Scala, Scheme, Sed, Swift, TCL, Text, Turing, VB, Zig

The number S is called the mean of two numbers R_1 and R_2 if S is equal to \frac{R_1+R_2}{2}. Mirko's birthday present for Slavko was two integers R_1 and R_2. Slavko promptly calculated their mean which also happened to be an integer but then lost R_2! Help Slavko restore R_2.

Input Specification

The first and only line of input contains two integers R_1 and S, both between -1\,000 and 1\,000.

Output Specification

Output R_2 on a single line.

Sample Input 1

11 15

Sample Output 1


Sample Input 2

4 3

Sample Output 2



There are no comments at the moment.