program main implicit none integer*8::C(26) integer*8::h,e,l,o,w,r,d integer*8::m real::x,n read *,C h = C(8) e = C(5) l = C(12) o = C(15) w = C(23) r = C(18) d = C(4) if(h.lt.1 .or. & e.lt.1 .or. & l.lt.3 .or. & o.lt.2 .or. & w.lt.1 .or. & r.lt.1 .or. & d.lt.1) then print '(i0)',0 else m = get_max(l) print '(i0)',h*e*m*(o-1)*w*r*d end if contains function get_max(l) result(m) integer*8::i,m,l m = 1 do i=2,l-1 m = MAX(m, (l-i)*i*(i-1)/2) end do end function get_max end program main