uses wincrt;

const
  colors: array[-2..10] of string = (
      'Silver',
      'Gold',
      'Black',
      'Brown',
      'Red',
      'Orange',
      'Yellow',
      'Green',
      'Blue',
      'Violet',
      'Gray',
      'White',
      'no color band');

function pwr10(x:integer):real; {pwr10 := 10^x}
  begin
    pwr10 := exp(x * ln(10));
  end;

function log10 (x: real):real  ; { base 10 log of x }
begin
  log10 := ln(x) / ln(10);
end;

function gint(x:real):integer; { greatest integer }
  begin
    if x>=0 then
      gint := trunc(x)
    else
      gint := trunc(x)-1;
  end;

var band: array[1..5] of integer;
    resistance:real;
    tolerance,i:integer;

begin
  write('Enter Resistance Value:  '); readln(resistance);
  write('Enter Tolerance Value (1,2,5 or 10 percent):  ');  readln(tolerance);

  if (tolerance=5) or (tolerance=10) then
    begin
      band[5] := 10;
      band[4] := -(tolerance div 5);
      band[3] := gint(log10(resistance))-1;
      band[1] := gint(resistance/pwr10(band[3]+1));
      band[2] := round(resistance/pwr10(band[3]))-10*band[1];
    end;

  if (tolerance=1) or (tolerance=2) then
    begin
      band[5] := tolerance-1;
      band[4] := gint(log10(resistance)-2);
      band[1] := gint(resistance/pwr10(band[4]+2));
      band[2] := gint(resistance/pwr10(band[4]+1))-10*band[1];
      band[3] := round(resistance/pwr10(band[4]))-100*band[1]-10*band[2];
    end;

  writeln;

  for i := 1 to 4 do
    begin
      write(colors[band[i]],' ');
    end;
  if band[5]<>10 then write(colors[band[5]]);

end.
