import "hashes/sha256/512bitPacked.code" as sha256packed

def main(private field[4] n_old, private field[4] n_new, field[2] hash_old, field[2] hash_new) -> (field):
    
    //check sum
    n_old[0] + n_old[1] + n_old[2] + n_old[3] == n_new[0] + n_new[1] + n_new[2] + n_new[3]
    
    // check old hash
    h_old = sha256packed([n_old[0], n_old[1], n_old[2], n_old[3]])
    h_old[0] == hash_old[0]
    h_old[1] == hash_old[1]

    // check new hash
    h_new = sha256packed([n_new[0], n_new[1], n_new[2], n_new[3]])
    h_new[0] == hash_new[0]
    h_new[1] == hash_new[1]
    
    return 1
