SAD1 ITU - Dynamic Programming