Language: C++

var cc : array [1..4] of int64 ;
    so : array [1..4] of real ;
    a,b,c,d,e,f,g : longint ;
    sum,count,h,i,o,j,k,l : int64 ;

procedure swap(var x,y : int64) ;
var z : int64;
begin
 z:=x;
 x:=y;
 y:=z;
end;
procedure swap2(var x,y : real) ;
var z : real;
begin
 z:=x;
 x:=y;
 y:=z;
end;

begin
 for a:=1 to 4 do
  begin
   read(cc[a]);
  end;
 so[1]:=1;
 so[2]:=1;
 so[3]:=1;
 so[4]:=2;
 cc[1]:=cc[1]*4;
 cc[2]:=cc[2]*2;
 for a:=1 to 3 do
  for b:=1 to 3 do
   if cc[b]*(1/so[b])>cc[b+1]*(1/so[b+1]) then
    begin
     swap(cc[b],cc[b+1]);
     swap2(so[b],so[b+1]);
    end;
//    for a:=1 to 4 do  write(cc[a]:5);
    readln(sum);
  while sum>0 do
   begin
    for a:=1 to 4 do
     begin
      if sum=0 then
       break
      else if so[a]<=sum then
       begin
//        writeln(cc[a]);
        if so[a]<>2 then
         begin
          count:=count+cc[a]*sum;
          sum:=0;
          break;
         end
        else
         begin
          count:=count+cc[a]*(sum div 2);
          sum:=sum-(sum div 2)*2;
         end;
       end;
     end;
   end;
  writeln(count);
end.


Compiler output:
a.cc:1:17: error: too many decimal points in number
    1 | var cc : array [1..4] of int64 ;
      |                 ^~~~
a.cc:2:17: error: too many decimal points in number
    2 |     so : array [1..4] of real ;
      |                 ^~~~
a.cc:1:1: error: 'var' does not name a type
    1 | var cc : array [1..4] of int64 ;
      | ^~~
a.cc:2:8: error: found ':' in nested-name-specifier, expected '::'
    2 |     so : array [1..4] of real ;
      |        ^
      |        ::
a.cc:2:5: error: 'so' does not name a type
    2 |     so : array [1..4] of real ;
      |     ^~
a.cc:3:5: error: 'a' does not name a type
    3 |     a,b,c,d,e,f,g : longint ;
      |     ^
a.cc:4:5: error: 'sum' does not name a type
    4 |     sum,count,h,i,o,j,k,l : int64 ;
      |     ^~~
a.cc:6:1: error: 'procedure' does not name a type
    6 | procedure swap(var x,y : int64) ;
      | ^~~~~~~~~
a.cc:7:1: error: 'var' does not name a type
    7 | var z : int64;
      | ^~~
a.cc:8:1: error: 'begin' does not name a type
    8 | begin
      | ^~~~~
a.cc:10:2: error: 'x' does not name a type
   10 |  x:=y;
      |  ^
a.cc:11:2: error: 'y' does not name a type
   11 |  y:=z;
      |  ^
a.cc:12:1: error: 'end' does not name a type
   12 | end;
      | ^~~
a.cc:13:1: error: 'procedure' does not name a type
   13 | procedure swap2(var x,y : real) ;
      | ^~~~~~~~~
a.cc:14:1: error: 'var' does not name a type
   14 | var z : real;
      | ^~~
a.cc:15:1: error: 'begin' does not name a type
   15 | begin
      | ^~~~~
a.cc:17:2: error: 'x' does not name a type
   17 |  x:=y;
      |  ^
a.cc:18:2: error: 'y' does not name a type
   18 |  y:=z;
      |  ^
a.cc:19:1: error: 'end' does not name a type
   19 | end;
      | ^~~
a.cc:21:1: error: 'begin' does not name a type
   21 | begin
      | ^~~~~
a.cc:25:3: error: 'end' does not name a type
   25 |   end;
      |   ^~~
a.cc:26:2: error: 'so' does not name a type
   26 |  so[1]:=1;
      |  ^~
a.cc:27:2: error: 'so' does not name a type
   27 |  so[2]:=1;
      |  ^~
a.cc:28:2: error: 'so' does not name a type
   28 |  so[3]:=1;
      |  ^~
a.cc:29:2: error: 'so' does not name a type
   29 |  so[4]:=2;
      |  ^~
a.cc:30:2: error: 'cc' does not name a type
   30 |  cc[1]:=cc[1]*4;
      |  ^~
a.cc:31:2: error: 'cc' does not name a type
   31 |  cc[2]:=cc[2]*2;
      |  ^~
a.cc:32:2: error: expected unqualified-id before 'for'
   32 |  for a:=1 to 3 do
      |  ^~~
a.cc:37:11: error: expected constructor, destructor, or type conversion before '(' token
   37 |      swap2(so[b],so[b+1]);
      |           ^
a.cc:38:5: error: 'end' does not name a type
   38 |     end;
      |     ^~~
a.cc:40:11: error: expected constructor, destructor, or type conversion before '(' token
   40 |     readln(sum);
      |           ^
a.cc:41:3: error: expected unqualified-id before 'while'
   41 |   while sum>0 do
      |   ^~~~~
a.cc:53:11: error: 'sum' does not name a type
   53 |           sum:=0;
      |           ^~~
a.cc:54:11: error: expected unqualified-id before 'break'
   54 |           break;
      |           ^~~~~
a.cc:55:10: error: 'end' does not name a type
   55 |          end
      |          ^~~
a.cc:59:11: error: 'sum' does not name a type
   59 |           sum:=sum-(sum div 2)*2;
      |           ^~~
a.cc:60:10: error: 'end' does not name a type
   60 |          end;
      |          ^~~
a.cc:61:8: error: 'end' does not name a type
   61 |        end;
      |        ^~~
a.cc:62:6: error: 'end' does not name a type
   62 |      end;
      |      ^~~
a.cc:63:4: error: 'end' does not name a type
   63 |    end;
      |    ^~~
a.cc:64:10: error: expected constructor, destructor, or type conversion before '(' token
   64 |   writeln(count);
      |          ^
a.cc:65:1: error: 'end' does not name a type
   65 | end.
      | ^~~