Хеллллпммиииииииии пжжжж
Type arr = array[1..100000] of longint; var d, k, i: longint; n, m: arr; begin readln(k); for i := 1 to k do begin read(n[i]); readln(m[i]); end; for i := 1 to k do begin d := 19 * m[i] + (n[i] + 239) * (n[i] + 366) div 2; writeln(d); end; end.