Unoptimized implementation