Bead Ornaments

  • + 0 comments

    Python

    def beadOrnaments(b):
        sumColor=0
        intercolor=1
        for color in b:
            intercolor*=color**(color-1)
            sumColor+=color
        intercolor*=sumColor**(len(b)-2)
        return int(intercolor%(10**9+7))