#include <stdio.h>

int main() {
    int a,i,j,h,u;
    int x[1000];
    int y[1000];
    scanf("%d",&a);
    for(int o=0;o<a;o++)
    {
        scanf("%d",&x[o]);
    }
    for(i=0;i<a;i++)
        {
            for(j=i+1;j<5;j++)
                {
                    if(x[i]>x[j])
                    {
                        h=x[i];
                        x[i]=x[j];
                        x[j]=h;
                    }
                }
        }
    for(int c=1;c<=a;c++)
        {
            for(int d=0;d<c;d++)
                {
                    y[c]+=x[d];
                    y[1]=1;
                }
            u+=y[c];
        }
    printf("%d",u);
    }

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: