Jasper Yu says to YSITD if gate == 1 then store(input) output = input else output = read_from_store() end if