usaco 2018 january contest

Java
2 1 7 4
5 -1 10 3

Source

Also in Java: