# your code goes here
import math

def bouquets(narcissus_price, tulip_price, rose_price, summ):
    prices = sorted( [ narcissus_price, tulip_price, rose_price ], reverse = True )
    counter = 0
    for i in range( math.floor( summ / prices[0] ) + 1 ):
        for j in range( math.floor( ( summ - i * prices[0] ) / prices[1] ) + 1):
            last_count = math.floor( ( summ - i * prices[0] - j * prices[1] ) / prices[2] ) + 1
            if ( i + j ) % 2 == 0 :
            	counter += math.floor( last_count / 2 )
            else :
            	counter += math.ceil(  last_count / 2 )
           
    return counter
    
print( bouquets(200,300,400,100000) )
