go version of prob 4