add three nodes dp