uses math;
const base=1000000000;
var n,m:longint;
    a,s:array[1..24]of longint;
    mang:array[1..24,1..1000,1..2]of longint;
    f:array[0..1,0..8400000]of longint;

function get(x,y:longint):longint;
begin
  get:=(x shr y)and 1;
end;

procedure nhap;
var i:longint;
begin
  assign(input,'');  reset(input);
  readln(n);
  for i:=1 to n do read(a[i]);
end;

function check(bit,value:longint):boolean;
var i,j:longint;
begin
  check:=true;
  for i:=1 to s[value] do
    if ((bit and mang[value,i,1])<>0)and((bit and mang[value,i,2])<>0) then
     exit;
  check:=false;
end;

procedure solve;
var i,now,t,next,j,bit,ans,count,pivot,temp:longint;
begin
  m:=(1 shl n)-1;
  for i:=0 to m do f[0,i]:=base;  f[0,1]:=1;
  now:=0;  next:=1;
  for i:=1 to n-1 do begin
    for j:=0 to ((1 shl (i+1))-1) do f[next,j]:=base;
    for j:=0 to ((1 shl i)-1) do if (f[now,j]<>base)and(check(j,i+1)) then begin
      bit:=j or (1 shl (i));
      ans:=f[now,j]+1;  f[next,bit]:=min(f[next,bit],ans);
      for t:=0 to i-1 do if get(bit,t)=1 then begin
        pivot:=bit xor (1 shl t);
        f[next,pivot]:=min(f[next,pivot],f[now,j]);
      end;
    end;
    temp:=now;  now:=next;  next:=temp;
  end;
  ans:=base;
  for i:=0 to m do ans:=min(ans,f[now,i]);
  if ans=base then writeln(-1) else writeln(ans);
end;

procedure init;
var i,j,t:longint;
begin
  fillchar(s,sizeof(s),0);
  for i:=2 to n do begin
    for j:=1 to i-1 do
      for t:=j to i-1 do if a[j]+a[t]=a[i] then begin
        inc(s[i]);
        mang[i,s[i],1]:=(1 shl (j-1));  mang[i,s[i],2]:=(1 shl (t-1));
      end;
  end;
end;

begin
  nhap;
  init;
  solve;
end.

uses math;
var res,t,j,n,i:longint;
    used:array[1..24,0..1 shl 23+10] of boolean;
    sz:array[0..25] of longint;
    b:array[1..25,0..10000] of record i,j:longint; end;
    a:array[0..25] of longint;
   function count(mask:longint):longint inline;
    var res:longint;
    begin
      res:=0;
      while (mask>0) do
       begin
         res:=res+1;
         mask:=mask and (mask-1);
       end;
      count:=res;
    end;

   procedure rec(v,mask,cost:longint);
    var j,i:longint;
    begin
      cost:=max(cost,count(mask));
      if cost>=res then exit;
      if v=n+1 then
       begin
         res:=cost;
         exit;
       end;
      if used[v][mask] then
       exit;
      used[v][mask]:=true;
      for i:=1 to sz[v] do
       begin
         if (mask and (1<<(b[v][i].i-1))>0)
         and(mask and (1<<(b[v][i].j-1))>0) then
          begin
            for j:=0 to v-2 do
             if (mask and (1<<j)>0) then rec(v+1,mask or (1<<(v-1)) xor (1<<j),cost);
            rec(v+1,mask or (1<<(v-1)),cost+1);
          end;
       end;
    end;
 begin
   read(n);
   for i:=1 to n do
    read(a[i]);
   for t:=1 to n do
    begin
      for i:=1 to t-1 do
       for j:=i to t-1 do
        if a[i]+a[j]=a[t] then
         begin
           inc(sz[t]);
           b[t][sz[t]].i:=i;
           b[t][sz[t]].j:=j;
         end;
    end;
   res:=maxlongint;
   rec(2,1,1);
   if res=maxlongint then writeln(-1)
   else writeln(res);
 end.

Program ddd;
Const
  Infile='';
  Outfile='';
Var
  f:Array[0..23,0..8389274]Of Shortint;
  map:Array[0..50,0..50] Of Longint;
  a:Array[0..50 ]Of Longint;
  flag:Boolean;
  ans,i,j,k,n:Longint;
Procedure Dfs(pos,zt:Longint);
Var
  dq,i,j:Longint;
Begin
  IF f[pos][zt]=ans Then Exit;
  If flag=True Then Exit;
  f[pos][zt]:=ans;
  If (pos=n) Then Begin
    flag:=True;
    Exit;
  End;
  For i:=1 To n Do
    If (zt And (1<<(i-1))<>0)And(zt And (1<<(map[i][pos+1]-1))<>0) Then Begin
      dq:=0;
      For j:=1 To n Do If (zt And (1<<(j-1))<>0) Then Inc(dq);
      If (dq<ans) Then Dfs(pos+1,zt Or (1<<pos))
        Else Begin
          For j:=1 To n Do If (zt And (1<<(j-1))<>0) Then
            Dfs(pos+1,zt Or (1<<pos) Xor(1<<(j-1)));
        End;
      Break;
    End;
End;
Begin
  Assign(Input,Infile);
  Assign(Output,Outfile);
  Reset(Input);
  Rewrite(Output);
  Readln(n);
  For i:=1 To n Do
    For j:=1 To n Do map[i][j]:=30;
  For i:=1 To n Do Read(a[i]);
  For i:=1 To n Do
    For j:=1 To n Do
      For k:=1 To n Do IF (a[i]+a[j]=a[k]) Then map[i][k]:=j;
  flag:=False;
  For ans:=1 To n Do Begin
    Dfs(1,1);
    If (flag=True) Then Begin
      Writeln(ans);
      Break;
    End;
  End;
  If flag=FAlse Then WRiteln(-1);
  Close(Input);
  Close(Output);
End.

var
used:array[0..24,0..(1 shl 23)]of boolean;
mask,mm,res:longint;
a:array[0..100]of longint;
i,j,n,m,t:longint;
sz:Array[0..100]of longint;
f1,f2:Array[0..40,0..10000]of longint;
function bit(mask,x:longint):boolean;
begin
 if (mask and (1<<x))>0 then bit:=true
 else bit:=false;
end;
procedure go(x, mask, cost:longint);
var x1,x2,mm,i,j:longint;
begin
 if used[x,mask] then exit;
 if cost>=res then exit;
 used[x,mask]:=true;
 if x=n+1 then
  begin
   res:=cost;
   exit;
  end;
 for i:=1 to sz[x] do
   begin
    x1:=f1[x,i];
    x2:=f2[x,i];
    if bit(mask,x1) and bit(mask, x2) then
      begin
         mm:=mask+(1<<(x-1));
         go(x+1, mm, cost+1);

         for j:=0 to n-1 do
          if bit(mask,j) then
           begin
            mm:=mask-(1<<j)+(1<<(x-1));
            go(x+1,mm,cost);
           end;
      end;
   end;
end;
 begin
   readln(n);
   res:=maxlongint;
   for i:=1 to n do read(a[i]);
   for t:=2 to n do
    begin
      for i:=1 to t-1 do
       for j:=i to t-1 do
         if (a[i]+a[j]=a[t]) then
          begin
            inc(sz[t]);
            f1[t,sz[t]]:=i-1;
            f2[t,sz[t]]:=j-1;
          end;
    end;
   go(2, 1, 1);
   if res=maxlongint then res:=-1;
   writeln(res);
 end.

{$M 100000000}

uses math;

type pp=record
         x,y:longint;
        end;

var i,l,n,x,y,ans:longint;
    c,v:array[0..101] of longint;
    a:array[0..9000001] of longint;
    b:array[0..25,0..501] of pp;
    w:array[0..8400000,0..22] of boolean;

procedure tt(x,t,l:longint);
var i,j,t1,t2:longint;
 begin
  l:=max(a[x],l);
  if l>ans then exit;

  if t=n then begin
               if l<ans then ans:=l;
               exit;
              end;

  if w[x,t] then exit;
  w[x,t]:=true;

  for i:=1 to c[t] do
   begin
    t1:=x and (1 shl b[t,i].x);
    t2:=x and (1 shl b[t,i].y);

    if (t1=0) or (t2=0) then continue;

    for j:=0 to t-1 do
     if x and (1 shl j)>0 then tt(x-(1 shl j)+(1 shl t),t+1,l);
    tt(x+(1 shl t),t+1,l);

   end;

 end;

 begin
  read(n);
  for i:=1 to n do
   read(v[i]);

  for i:=0 to n-1 do
   begin
    for x:=1 to n do
     for y:=x to n do
      if v[x]+v[y]=v[i+1] then begin
                                inc(c[i]);
                                b[i,c[i]].x:=x-1;
                                b[i,c[i]].y:=y-1;
                               end;
   end;

  ans:=n+1;
  l:=1 shl n-1;
  for i:=0 to l do
   begin
    x:=i;
    while x>0 do
     begin
      a[i]:=a[i]+x mod 2;
      x:=x div 2;
     end;
   end;

  tt(1,1,0);
  if ans>n then ans:=-1; writeln(ans);
 end.

var z, ans, bc, a, b, n, i, j, k, qn, qm, e, mask, nmask : longint;
    q1, q2, was : array[0 .. 1 shl 23] of longint;
    aa, cn : array[0 .. 111] of longint;
    x, y : array[0 .. 111, 0 .. 1111] of longint;

begin
    read(n);
    if (n = 1) then begin
        writeln(1);
        halt(0);
    end;
    for i := 1 to n do read(aa[i]);
    fillchar(x, sizeof(x), 0);
    fillchar(y, sizeof(y), 0);
    for i := 1 to n do begin
        cn[i] := 0;
        for j := 1 to i - 1 do begin
            for k := j to i - 1 do begin
                if (aa[j] + aa[k] <> aa[i]) then continue;
                x[i][cn[i]] := j;
                y[i][cn[i]] := k;
                inc(cn[i]);
            end;
        end;
    end;
    q1[0] := 2;
    qn := 1;
    fillchar(was, sizeof(was), 0);
    for i := 2 to n - 1 do begin
        qm := 0;
        for j := 0 to qn - 1 do begin
            mask := q1[j];
            for e := 0 to cn[i] - 1 do begin
                a := x[i][e];
                b := y[i][e];
                if (((mask shr a) and 1) = 0) or (((mask shr b) and 1) = 0) then continue;
                for z := 1 to i - 1 do begin
                    if (((mask shr z) and 1) = 1) then begin
                        nmask := mask xor (1 shl z) xor (1 shl i);
                        if was[nmask] = i then continue;
                        was[nmask] := i;
                        q2[qm] := nmask;
                        inc(qm);
                    end;
                end;
                nmask := mask xor (1 shl i);
                if was[nmask] = i then continue;
                was[nmask] := i;
                q2[qm] := nmask;
                inc(qm);
            end;
        end;
        qn := qm;
        for j := 0 to qn - 1 do q1[j] := q2[j];
    end;
    ans := 1 shl 30;
    for z := 0 to qn - 1 do begin
        mask := q1[z];
        bc := 0;
        for i := 1 to n - 1 do if (((mask shr i) and 1) = 1) then inc(bc);
        if ans <= bc then continue;
        for i := 0 to cn[n] - 1 do begin
            a := x[n][i];
            b := y[n][i];
            if (((mask shr a) and 1) = 0) or (((mask shr b) and 1) = 0) then continue;
            ans := bc;
            break;
        end;
    end;
    if (ans = 1 shl 30) then writeln(-1) else writeln(ans);
end.

program problem4;
uses math, dos;

const	m = ( 1 shl 23 ) + 10;

var	n, r: longInt;
	used: array[ 0..m ] of boolean;
	s: array[ 1..m ] of longInt;

procedure add( mask: longInt );
begin
	if ( used[mask] ) then
		exit();

	used[mask] := true;
	s[r] := mask;
	inc( r );
end;

function leftBit( mask: longInt ): longInt;
var	i, res: longInt;
begin
	res := 1;
	for i := 1 to n do
		if ( ( mask and ( 1 shl (i-1) ) ) > 0 ) then
			res := i;

	exit( res );
end;

function bitCnt( mask: longInt ): longInt;
var	i, res: longInt;
begin
	res := 0;
	for i := 0 to n do
		if ( ( mask and ( 1 shl i ) ) > 0 ) then
			inc( res );

	exit( res );
end;

var	i, j, k, l, ans: longInt;
	a: array[ 1..25 ] of longInt;
	b: array[ 1..25, 1..25 ] of longInt;
	ok: boolean;
	t1, t2: int64;

begin
	t1 := getMsCount();
	fillchar( b, sizeOf(b), 0 );

	readln( n );
	for i := 1 to n do
		read( a[i] );

	for i := 1 to n do
		for j := i to n do
			for k := (j+1) to n do
				if ( ( a[i] + a[j] ) = a[k] ) then
				begin
					b[i][k] := b[i][k] or ( 1 shl (j-1) );
					b[j][k] := b[j][k] or ( 1 shl (i-1) );
				end;

	ans := n + 1;
	l := 1;
	r := 2;
	s[1] := 1;
	while ( l < r ) do
	begin
		t2 := getMsCount();
		if ( (t2-t1) > 1980 ) then
			break;

		k := leftBit( s[l] );
		if ( k = n ) then
			ans := min( ans, bitCnt( s[l] ) );

		ok := false;
		for i := 1 to k do
			if ( ( s[l] and ( 1 shl (i-1) ) ) > 0 ) and ( ( s[l] and b[i][k+1] ) > 0 ) then
			begin
				ok := true;
				break;
			end;

		if ( ok ) then
		begin
			for i := 1 to k do
				if ( ( s[l] and ( 1 shl (i-1) ) ) > 0 ) then
					add( s[l] + ( 1 shl k ) - ( 1 shl (i-1) ) );

			add( s[l] + ( 1 shl k ) );
		end;

		inc( l );
	end;

	if ( ans  = (n+1) ) then
		ans := -1;

	writeln( ans );
end.

Var n,i,j,u,ans,o:longint;
    e,d,a:array[0..123]of longint;
    f:array[0..1 shl 23]of longint;
    b:array[0..25,0..1001,1..2]of longint;
    used:array[2..24,0..1 shl 23]of boolean;
 procedure rec(x,mask,cnt:longint);
   var i,x1,x2,j:longint;
     begin
       if used[x,mask] then exit;
       used[x,mask]:=true;
       if cnt>=ans then exit;
       if x=n+1 then
         begin
           ans:=cnt;
           exit;
         end;
       o:=o+e[x];
       if o>200000000 then exit;
       for i:=1 to e[x] do
         begin
           x1:=b[x,i,1];
           x2:=b[x,i,2];
           if mask and d[x1-1]>0 then if mask and d[x2-1]>0 then
             begin
               rec(x+1,mask xor d[x-1],cnt+ord(f[mask]=cnt));
               if f[mask]=cnt then
               for j:=0 to x-2 do
                 if d[j] and mask>0 then rec(x+1,mask xor d[x-1] xor d[j],cnt);
             end;
         end;
     end;
  begin
    read(n);
    d[0]:=1;
    for i:=1 to 30 do
      d[i]:=d[i-1]+d[i-1];
    for i:=1 to d[n]-1 do
      for j:=0 to n do
        if i and d[j]>0 then inc(f[i]);
    for i:=1 to n do
      read(a[i]);
    for i:=1 to n do
      for j:=1 to i-1 do
        for u:=j to i-1 do
          if a[u]+a[j]=a[i]
            then
              begin
               inc(e[i]);
               b[i,e[i],1]:=j;
               b[i,e[i],2]:=u;
              end;
    ans:=maxlongint;
    rec(2,1,1);
    if ans=maxlongint then ans:=-1;
    Writeln(ans);
  end.

var n,i,j,k,t,x,y,z:integer;
a:array [1..23] of integer;
b:array [1..9000000] of integer;
c:array [0..25] of integer;
d:array [1..23,0..50] of integer;

begin
readln(n);
for i:=1 to n do read(a[i]);
for i:=1 to 9000000 do b[i]:=1000000;
b[1]:=1;
c[0]:=1;
for i:=1 to 25 do c[i]:=2*c[i-1];
for i:=1 to 23 do
  begin
  for j:=0 to 50 do d[i,j]:=0;
  end;
for i:=2 to n do
  begin
  for j:=1 to i-1 do
    begin
    for k:=j to i-1 do
      begin
      if a[j]+a[k]=a[i] then
        begin
        d[i,0]+=1;
        if j<>k then d[i,d[i,0]]:=c[j]+c[k] else d[i,d[i,0]]:=c[j];
        end;
      end;
    end;
  end;
for i:=1 to c[n-1]-1 do
  begin
  if b[i]<>1000000 then
    begin
    x:=i;
    j:=0;
    while c[j]<=x do j+=1;
    y:=j;
    //writeln(i,' ',y);
    x+=c[y];
    if b[i]+1<b[x] then
      begin
      t:=0;
      for k:=1 to d[y+1,0] do
        begin
        if (x and d[y+1,k])=d[y+1,k] then
          begin
          t:=1;
          break;
          end;
        end;
      if t=1 then
        begin
        if b[x]>b[i]+1 then b[x]:=b[i]+1;
        end;
      end;
    for j:=0 to y-1 do
      begin
      if (x and c[j])<>0 then
        begin
        z:=x-c[j];
        t:=0;
        for k:=1 to d[y+1,0] do
          begin
          if (z and d[y+1,k])=d[y+1,k] then
            begin
            t:=1;
            break;
            end;
          end;
        if t=1 then
          begin
          if b[z]>b[i] then b[z]:=b[i];
          end;
        end;
      end;
    end;
  end;
x:=1000000;
for i:=c[n-1] to c[n]-1 do
  begin
  if b[i]<x then x:=b[i];
  end;
if x=1000000 then writeln(-1) else writeln(x);
end.

uses math;

type pp=record
         x,y:longint;
        end;

var i,l,n,x,y,ans:longint;
    c,v:array[0..101] of longint;
    a:array[0..9000001] of longint;
    b:array[0..25,0..501] of pp;

procedure tt(x,t,l:longint);
var i,t1,t2:longint;
 begin
  l:=max(a[x],l);
  if l>ans then exit;

  if t=n then begin
               if l<ans then ans:=l;
               exit;
              end;

  for i:=1 to c[t] do
   begin
    t1:=x and (1 shl b[t,i].x);
    t2:=x and (1 shl b[t,i].y);

    if (t1=0) or (t2=0) then continue;

    tt(x+(1 shl t),t+1,l);
    tt(x+(1 shl t)-(1 shl b[t,i].x),t+1,l);
    tt(x+(1 shl t)-(1 shl b[t,i].y),t+1,l);
   end;

 end;

 begin
  read(n);
  for i:=1 to n do
   read(v[i]);

  for i:=0 to n-1 do
   begin
    for x:=1 to n do
     for y:=x to n do
      if v[x]+v[y]=v[i+1] then begin
                                inc(c[i]);
                                b[i,c[i]].x:=x-1;
                                b[i,c[i]].y:=y-1;
                               end;
   end;

  ans:=n+1;
  l:=1 shl n-1;
  for i:=0 to l do
   begin
    x:=i;
    while x>0 do
     begin
      a[i]:=a[i]+x mod 2;
      x:=x div 2;
     end;
   end;

  tt(1,1,0);
  if ans>n then ans:=-1; writeln(ans);
 end.

program problem4;
uses math, dos;

const	m = ( 1 shl 23 ) + 10;

var	n, r: longInt;
	used: array[ 0..m ] of boolean;
	s: array[ 1..m ] of longInt;

procedure add( mask: longInt );
begin
	if ( used[mask] ) then
		exit();

	used[mask] := true;
	inc( r );
	s[r] := mask;
end;

function leftBit( mask: longInt ): longInt;
var	i, res: longInt;
begin
	res := 1;
	for i := 1 to n do
		if ( ( mask and ( 1 shl (i-1) ) ) > 0 ) then
			res := i;

	exit( res );
end;

function bitCnt( mask: longInt ): longInt;
var	i, res: longInt;
begin
	res := 0;
	for i := 0 to n do
		if ( ( mask and ( 1 shl i ) ) > 0 ) then
			inc( res );

	exit( res );
end;

var	i, j, k, l, ans: longInt;
	a: array[ 1..25 ] of longInt;
	b: array[ 1..25, 1..25 ] of longInt;
	ok: boolean;
	t1, t2: int64;

begin
	t1 := getMsCount();
	fillchar( b, sizeOf(b), 0 );

	readln( n );
	for i := 1 to n do
		read( a[i] );

	for i := 1 to n do
		for j := i to n do
			for k := (j+1) to n do
				if ( ( a[i] + a[j] ) = a[k] ) then
				begin
					b[i][k] := b[i][k] or ( 1 shl (j-1) );
					b[j][k] := b[j][k] or ( 1 shl (i-1) );
				end;

	ans := n + 1;
	l := 1;
	r := 2;
	s[1] := 1;
	while ( l < r ) do
	begin
		t2 := getMsCount();
		if ( (t2-t1) > 1980 ) then
			break;

		k := leftBit( s[l] );
		if ( k = n ) then
			ans := min( ans, bitCnt( s[l] ) );

		ok := false;
		for i := 1 to k do
			if ( ( s[l] and ( 1 shl (i-1) ) ) > 0 ) and ( ( s[l] and b[i][k+1] ) > 0 ) then
			begin
				ok := true;
				break;
			end;

		if ( ok ) then
		begin
			for i := 1 to k do
				if ( ( s[l] and ( 1 shl (i-1) ) ) > 0 ) then
					add( s[l] + ( 1 shl k ) - ( 1 shl (i-1) ) );

			add( s[l] + ( 1 shl k ) );
		end;

		inc( l );
	end;

	if ( ans  = (n+1) ) then
		ans := -1;

	writeln( ans );
end.

program problem4;
uses math, dos;

const	m = ( 1 shl 23 ) + 10;

var	n, r: longInt;
	used: array[ 0..m ] of boolean;
	s: array[ 1..m ] of longInt;

procedure add( mask: longInt );
begin
	if ( used[mask] ) then
		exit();

	used[mask] := true;
	inc( r );
	s[r] := mask;
end;

function leftBit( mask: longInt ): longInt;
var	i, res: longInt;
begin
	res := 1;
	for i := 1 to n do
		if ( ( mask and ( 1 shl (i-1) ) ) > 0 ) then
			res := i;

	exit( res );
end;

function bitCnt( mask: longInt ): longInt;
var	i, res: longInt;
begin
	res := 0;
	for i := 0 to n do
		if ( ( mask and ( 1 shl i ) ) > 0 ) then
			inc( res );

	exit( res );
end;

var	i, j, k, l, ans: longInt;
	a: array[ 1..25 ] of longInt;
	b: array[ 1..25, 1..25 ] of longInt;
	ok: boolean;
	t1, t2: int64;

begin
	t1 := getMsCount();
	fillchar( b, sizeOf(b), 0 );

	readln( n );
	for i := 1 to n do
		read( a[i] );

	for i := 1 to n do
		for j := i to n do
			for k := (j+1) to n do
				if ( ( a[i] + a[j] ) = a[k] ) then
				begin
					b[i][k] := b[i][k] or ( 1 shl (j-1) );
					b[j][k] := b[j][k] or ( 1 shl (i-1) );
				end;

	ans := n + 1;
	l := 1;
	r := 2;
	s[1] := 1;
	while ( l < r ) do
	begin
		t2 := getMsCount();
		if ( (t2-t1) > 1980 ) then
			break;

		k := leftBit( s[l] );
		if ( k = n ) then
			ans := min( ans, bitCnt( s[l] ) );

		ok := false;
		for i := 1 to k do
			if ( ( s[l] and ( 1 shl (i-1) ) ) > 0 ) and ( ( s[l] and b[i][k+1] ) > 0 ) then
			begin
				ok := true;
				break;
			end;

		if ( ok ) then
		begin
			add( s[l] + ( 1 shl k ) );

			for i := 1 to k do
				if ( ( s[l] and ( 1 shl (i-1) ) ) > 0 ) then
					add( s[l] + ( 1 shl k ) - ( 1 shl (i-1) ) );
		end;

		inc( l );
	end;

	if ( ans  = (n+1) ) then
		ans := -1;

	writeln( ans );
end.

var res,t,j,n,i:longint;
    used:array[1..24,0..1 shl 23+10] of boolean;
    sz:array[0..25] of longint;
    b:array[1..25,0..10000] of record i,j:longint; end;
    a:array[0..25] of longint;
   function count(mask:longint):longint inline;
    var res:longint;
    begin
      res:=0;
      while (mask>0) do
       begin
         res:=res+1;
         mask:=mask and (mask-1);
       end;
      count:=res;
    end;

   procedure rec(v,mask:longint);
    var i:longint;
    begin
      if count(mask)>=res then exit;
      if v=n+1 then
       begin
         res:=count(mask);
         exit;
       end;
      if used[v][mask] then
       exit;
      used[v][mask]:=true;
      for i:=1 to sz[v] do
       begin
         if (mask and (1<<(b[v][i].i-1))>0)
         and(mask and (1<<(b[v][i].j-1))>0) then
          begin
            rec(v+1,mask or (1<<(v-1)));
            rec(v+1,mask or (1<<(v-1)) xor (1<<(b[v][i].i-1)));
            rec(v+1,mask or (1<<(v-1)) xor (1<<(b[v][i].j-1)));
          end;
       end;
    end;
 begin
   read(n);
   for i:=1 to n do
    read(a[i]);
   for t:=1 to n do
    begin
      for i:=1 to t-1 do
       for j:=i to t-1 do
        if a[i]+a[j]=a[t] then
         begin
           inc(sz[t]);
           b[t][sz[t]].i:=i;
           b[t][sz[t]].j:=j;
         end;
    end;
   res:=maxlongint;
   rec(2,1);
   if res=maxlongint then writeln(-1)
   else writeln(res);
 end.

uses math;
var res,t,j,n,i:longint;
    used:array[1..24,0..1 shl 23+10] of boolean;
    sz:array[0..25] of longint;
    b:array[1..25,0..10000] of record i,j:longint; end;
    a:array[0..25] of longint;
   function count(mask:longint):longint inline;
    var res:longint;
    begin
      res:=0;
      while (mask>0) do
       begin
         res:=res+1;
         mask:=mask and (mask-1);
       end;
      count:=res;
    end;

   procedure rec(v,mask,cost:longint);
    var i:longint;
    begin
      cost:=max(cost,count(mask));
      if cost>=res then exit;
      if v=n+1 then
       begin
         res:=cost;
         exit;
       end;
      if used[v][mask] then
       exit;
      used[v][mask]:=true;
      for i:=1 to sz[v] do
       begin
         if (mask and (1<<(b[v][i].i-1))>0)
         and(mask and (1<<(b[v][i].j-1))>0) then
          begin
            for j:=0 to v-2 do
             if (mask and (1<<j)>0) then rec(v+1,mask or (1<<(v-1)) xor (1<<j),cost);
            rec(v+1,mask or (1<<(v-1)),cost+1);
          end;
       end;
    end;
 begin
   read(n);
   for i:=1 to n do
    read(a[i]);
   for t:=1 to n do
    begin
      for i:=1 to t-1 do
       for j:=i to t-1 do
        if a[i]+a[j]=a[t] then
         begin
           inc(sz[t]);
           b[t][sz[t]].i:=i;
           b[t][sz[t]].j:=j;
         end;
    end;
   res:=maxlongint;
   rec(2,1,1);
   if res=maxlongint then writeln(-1)
   else writeln(res);
 end.

uses math;
const base=1000000000;
var n,m:longint;
    a,s:array[1..24]of longint;
    mang:array[1..24,1..1000,1..2]of longint;
    f:array[0..1,0..8400000]of longint;

function get(x,y:longint):longint;
begin
  get:=(x shr y)and 1;
end;

procedure nhap;
var i:longint;
begin
  assign(input,'');  reset(input);
  readln(n);
  for i:=1 to n do read(a[i]);
end;

function check(bit,value:longint):boolean;
var i,j:longint;
begin
  check:=true;
  for i:=1 to s[value] do
    if ((bit and mang[value,i,1])<>0)and((bit and mang[value,i,2])<>0) then
     exit;
  check:=false;
end;

procedure solve;
var i,now,t,next,j,bit,ans,count,pivot,temp:longint;
begin
  m:=(1 shl n)-1;
  for i:=1 to m do f[0,i]:=base;  f[0,1]:=1;
  now:=0;  next:=1;
  for i:=1 to n-1 do begin
    for j:=0 to ((1 shl (i+1))-1) do f[next,j]:=base;
    for j:=0 to ((1 shl i)-1) do if (f[now,j]<>base)and(check(j,i+1)) then begin
      bit:=j or (1 shl (i));
      ans:=f[now,j]+1;  f[next,bit]:=min(f[next,bit],ans);
      for t:=0 to i-1 do if get(bit,t)=1 then begin
        pivot:=bit xor (1 shl t);
        f[next,pivot]:=min(f[next,pivot],f[now,j]);
      end;
    end;
    temp:=now;  now:=next;  next:=temp;
  end;
  ans:=base;
  for i:=0 to m do ans:=min(ans,f[now,i]);
  if ans=base then writeln(-1) else writeln(ans);
end;

procedure init;
var i,j,t:longint;
begin
  fillchar(s,sizeof(s),0);
  for i:=2 to n do begin
    for j:=1 to i-1 do
      for t:=j to i-1 do if a[j]+a[t]=a[i] then begin
        inc(s[i]);
        mang[i,s[i],1]:=(1 shl (j-1));  mang[i,s[i],2]:=(1 shl (t-1));
      end;
  end;
end;

begin
  nhap;
  init;
  solve;
end.

var z, ans, bc, a, b, n, i, j, k, qn, qm, e, mask, nmask : longint;
    q1, q2, was : array[0 .. 1 shl 23] of longint;
    aa, cn : array[0 .. 111] of longint;
    x, y : array[0 .. 111, 0 .. 1111] of longint;

begin
    read(n);
    for i := 1 to n do read(aa[i]);
    fillchar(x, sizeof(x), 0);
    fillchar(y, sizeof(y), 0);
    for i := 1 to n do begin
        cn[i] := 0;
        for j := 1 to i - 1 do begin
            for k := j to i - 1 do begin
                if (aa[j] + aa[k] <> aa[i]) then continue;
                x[i][cn[i]] := j;
                y[i][cn[i]] := k;
                inc(cn[i]);
            end;
        end;
    end;
    q1[0] := 2;
    qn := 1;
    fillchar(was, sizeof(was), 0);
    for i := 2 to n - 1 do begin
        qm := 0;
        for j := 0 to qn - 1 do begin
            mask := q1[j];
            for e := 0 to cn[i] - 1 do begin
                a := x[i][e];
                b := y[i][e];
                if (((mask shr a) and 1) = 0) or (((mask shr b) and 1) = 0) then continue;
                for z := 1 to i - 1 do begin
                    if (((mask shr z) and 1) = 1) then begin
                        nmask := mask xor (1 shl z) xor (1 shl i);
                        if was[nmask] = i then continue;
                        was[nmask] := i;
                        q2[qm] := nmask;
                        inc(qm);
                    end;
                end;
                nmask := mask xor (1 shl i);
                if was[nmask] = i then continue;
                was[nmask] := i;
                q2[qm] := nmask;
                inc(qm);
            end;
        end;
        qn := qm;
        for j := 0 to qn - 1 do q1[j] := q2[j];
    end;
    ans := 1 shl 30;
    for z := 0 to qn - 1 do begin
        mask := q1[z];
        bc := 0;
        for i := 1 to n - 1 do if (((mask shr i) and 1) = 1) then inc(bc);
        if ans <= bc then continue;
        for i := 0 to cn[n] - 1 do begin
            a := x[n][i];
            b := y[n][i];
            if (((mask shr a) and 1) = 0) or (((mask shr b) and 1) = 0) then continue;
            ans := bc;
            break;
        end;
    end;
    if (ans = 1 shl 30) then writeln(-1) else writeln(ans);
end.

Var n,i,j,u,ans,o:longint;
    e,d,a:array[0..123]of longint;
    f:array[0..1 shl 23]of longint;
    b:array[0..25,0..1001,1..2]of longint;
 procedure rec(x,mask,cnt:longint);
   var i,x1,x2:longint;
     begin
       if cnt>=ans then exit;
       if x=n+1 then
         begin
           ans:=cnt;
           exit;
         end;
       i:=o+e[x];
       if o>100000000 then exit;
       for i:=1 to e[x] do
         begin
           x1:=b[x,i,1];
           x2:=b[x,i,2];
           if mask and d[x1-1]>0 then if mask and d[x2-1]>0 then
             begin
               for j:=0 to x-2 do
                 if d[j] and mask>0 then rec(x+1,mask xor d[x-1] xor d[j],cnt);
               rec(x+1,mask xor d[x-1],cnt+1);
             end;
         end;
     end;
  begin
    read(n);
    d[0]:=1;
    for i:=1 to 30 do
      d[i]:=d[i-1]+d[i-1];
    for i:=1 to d[n]-1 do
      for j:=0 to n do
        if i and d[j]>0 then inc(f[i]);
    for i:=1 to n do
      read(a[i]);
    for i:=1 to n do
      for j:=1 to i-1 do
        for u:=j to i-1 do
          if a[u]+a[j]=a[i]
            then
              begin
               inc(e[i]);
               b[i,e[i],1]:=j;
               b[i,e[i],2]:=u;
              end;
    ans:=maxlongint;
    rec(2,1,1);
    if ans=maxlongint then ans:=-1;
    Writeln(ans);
  end.

Var n,i,j,u,ans,o:longint;
    e,d,a:array[0..123]of longint;
    f:array[0..1 shl 23]of longint;
    b:array[0..25,0..1001,1..2]of longint;
 procedure rec(x,mask,cnt:longint);
   var i,x1,x2:longint;
     begin
       if cnt>=ans then exit;
       if x=n+1 then
         begin
           ans:=cnt;
           exit;
         end;
       i:=o+e[x];
       if o>100000000 then exit;
       for i:=1 to e[x] do
         begin
           x1:=b[x,i,1];
           x2:=b[x,i,2];
           if mask and d[x1-1]>0 then if mask and d[x2-1]>0 then
             begin
               for j:=0 to x-2 do
                 if d[j] and mask>0 then rec(x+1,mask xor d[x-1] xor d[j],cnt);
               rec(x+1,mask xor d[x-1],cnt+ord(f[mask]=cnt));
             end;
         end;
     end;
  begin
    read(n);
    d[0]:=1;
    for i:=1 to 30 do
      d[i]:=d[i-1]+d[i-1];
    for i:=1 to d[n]-1 do
      for j:=0 to n do
        if i and d[j]>0 then inc(f[i]);
    for i:=1 to n do
      read(a[i]);
    for i:=1 to n do
      for j:=1 to i-1 do
        for u:=j to i-1 do
          if a[u]+a[j]=a[i]
            then
              begin
               inc(e[i]);
               b[i,e[i],1]:=j;
               b[i,e[i],2]:=u;
              end;
    ans:=maxlongint;
    rec(2,1,1);
    if ans=maxlongint then ans:=-1;
    Writeln(ans);
  end.


var n,k:longint;
begin
  readln(n,k);
  for k:=1 to k do
    if n mod 10=0 then
      n:=n div 10
    else
      dec(n);
  writeln(n);
end.

program test;
var
   n, k, i: longint;

begin
   read(n, k);
   for i:=1 to k do
      if n mod 10 = 0 then n:=n div 10 else dec(n);
   write(n);
end.

program project1;
 var
  n:longint;
  i,k:byte;

begin
  read(n,k);

  for i:=1 to k do
  if n mod 10 <>0 then dec(n) else n:=n div 10;

  write(n);

end.

var n,k,i,z,p:longint;
begin
readln(n,k);
for i:=1 to k do
if n mod 10<>0 then dec(n)else  if n mod 10=0 then n:=n div 10;
write(n);
end.

var
i,j,c,x,d,e,b,n:longint;
begin
read(x,n);
while(i<=n-1) do
begin
inc(i);
if x mod 10=0 then begin x:=x div 10;end
else
dec(x);
end;
writeln(x);
end.

var
  n,k,i:longint;
begin
  readln(n,k);
  for i:=1 to k do
    begin
      if n mod 10<>0 then dec(n)
                     else n:=n div 10;
    end;
  write(n);
end.

var
 i,n,k:longint;
begin
  readln(n,k);
  for i:=1 to k do
    if n mod 10<>0 then dec(n)
      else n:=n div 10;
  writeln(n);
end.

var
  s: string;
  k: integer;
  buffer: integer;

begin
  readln(s);
  k := StrToInt(Copy(s, pos(' ', s), length(s)));
  Delete(s,pos(' ',s), length(s));
  while(k <> 0) do
  begin
    if s[length(s)] <> '0' then
    begin
      buffer := s.ToInteger;
      dec(buffer);
      s := buffer.ToString;
      dec(k);
    end
    else if s[length(s)] = '0' then
      begin
        s := Copy(s, 1, length(s) - 1);
        dec(k);
      end;
  end;

  writeln(s);
end.

var
n,k,r,o:longint;
begin
read(n,k);
o:=n;
r:=0;
repeat
r:=r+1;
if o mod 10<>0 then o:=o-1
else o:=o div 10;
until r=k;
write(o);
end.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var
  n, k, i:integer;
begin
  readln(n, k);
  for i := 1 to k do
    if (n mod 10 = 0)then n := n div 10
    else dec(n);
  writeln(n);
  readln;
end.

program canhtoan;
uses math;
var n:int64;
    k:longint;
procedure main();
var i:longint;
begin
read(n,k);
for i:=1 to k do
    begin
      if n mod 10=0 then n:=n div 10
      else n:=n-1;
    end;
write(n);
end;
BEGIN
  main();
END.

program Project2;

{$APPTYPE CONSOLE}

uses
  SysUtils;

var i,a,b:longint;

begin
  { TODO -oUser -cConsole Main : Insert code here }
  read(a,b);
                  for i :=1 to b do
                        begin
                        if (a mod 10) = 0 then a:=a div 10
                        else a:=a-1;
                        end;
                        write(a);

end.

{$A8,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O-,P+,Q-,R+,S+,T-,U-,V+,W-,X+,Y+,Z1}
{$MINSTACKSIZE $00004000}
{$MAXSTACKSIZE $00100000}
{$IMAGEBASE $00400000}
{$APPTYPE CONSOLE}

const filename='qc';
      oo=maxlongint div 2;
      eps=1e-6;
      eee=1e-21;

var qq,cc,a,aa:array[0..1000000]of longint;
    qc,he:array[0..2014,0..2014]of longint;
    ss,sss:array[0..10000]of string;
    s,s0,s1,s2,s3:string;
    x,y,z,xx,yy,zz,x0,y0,z0,x1,x2,x3,y1,y2,y3,z1,z2,z3:extended;
    res64,n64,nn64:int64;
    w,nt,ii,jj,n,m,q,c,q0,c0,q1,c1,q2,c2,q3,c3:longint;
    nn,mm,kk,u,v,res,cur,max,min:longint;
    test,ll,t,tt:longint;
    b,bb,bbb,b0,b1,b2,b3:boolean;
    ccc:char;

function mx(q,c:longint):longint;
  begin
  if q>c then mx:=q else mx:=c;
  end;

function mn(q,c:longint):longint;
  begin
  if q<c then mn:=q else mn:=c;
  end;

procedure init;
  begin
  assign(input,filename+'.in');
  assign(output,filename+'.out');
  reset(input);
  rewrite(output);
  end;

procedure fin;
  begin
  close(input);
  close(output);
  end;

procedure clear;
var i,j,k:longint;
  begin
  fillchar(qc,sizeof(qc),0);
  end;

procedure load;
var i,j,k:longint;
  begin
  end;

procedure save;
var i,j,k:longint;
  begin
  end;

procedure swap(var q,c:longint);
var i:longint;
    begin
    i:=q; q:=c; c:=i;
    end;

procedure run;
var i,j,k:longint;
  begin
  //init;
  readln(res,n);
  for i:=1 to n do if res mod 10=0 then res:=res div 10 else dec(res);
  writeln(res);

  //fin;
  end;

begin
nt:=1;
//readln(nt);
for test:=1 to nt do
  begin
  clear;
  load;
  run;
  save;
  end;
end.

var n,k,i:longint;
begin
     read(n,k);
     for i:=1 to k do
     begin
          if n mod 10=0
          then n:=n div 10
          else n:=n-1;
     end;
     writeln(n);
end.

var n:longint; k:byte;
begin
readln(n,k);
while k<>0 do
begin
    if n mod 10 <>0 then n:=n-1 else n:=n div 10;
    dec(k);
end;
write(n);
end.

var
n,n1:longint;
i, k:longint;

begin
  readln(n,k);
  for i:=1 to k do begin
    if (n mod 10)=0 then
        n:=n div 10
    else n:=n-1;
  end;
  writeln(n);
end.

var n,i,s1,s2:longint;l,k:longint;
begin
readln(n,k);
while k>0 do
begin
i:=n mod 10;
if i<>0 then n:=n-1 else n:=n div 10;
k:=k-1;
end;
writeln(n);
readln;
end.

Var
 n:real;
 i,n2:integer;
Begin
readln(n,n2);
 for i := 1 to n2 do begin
 if trunc(n) mod 10 = 0 then
 n:=n/10
 else
 n:=n-1;
 end;
writeln(trunc(n));
end.

 var
 i,j,k,n,s:longint;
 begin
 readln(n,k);
 for i:=1 to k do
 if n mod 10=0 then n:=n div 10 else n:=n-1;
 writeln(n);
 end.

var k:longword;n:qword;f,h:text;a:byte;
begin
read(n,k);
while k > 0 do
begin
a:=n mod 10;
if a<>0 then n:=n-1;
if a=0 then n:=n div 10;
dec(k);
end;
write(n);
end.

 var n,k,i:longint;
begin
read(n,k);
for i:=1 to k do
         begin
         if n mod 10<>0 then dec(n)
                        else n:=n div 10;
         end;
writeln(n);
end.

var n,n1,k,i:integer;
begin
read(n,k);   n1:=n;
for i:=1 to k do
if n1 mod 10<>0
  then n1:=n1-1
  else n1:=n1 div 10;
writeln(n1);
end.

var
	i,n,k:longint;

begin
	readln(n,k);
	for i:=1 to k do
		begin
			if (n mod 10<>0) then dec(n)
				else n:=n div 10;
		end;
	writeln(n);

end.

program tanya;
var
	n,k,i:longint;
begin
	read(n,k);
	for i:=1 to k do
	begin
		if(n mod 10<>0) then
		n:=n-1
		else
		n:=n div 10;
	end;
	writeln(n);
end.

var
  k,i:longint;
  n:int64;
begin
  readln(n,k);
  for i:=1 to k do if n mod 10=0 then n:=n div 10 else n:=n-1;
  writeln(n);
end.

var i, n, k: integer;
begin
    readln(n, k);
    for i:= 1 to k do
    begin
        if n mod 10 = 0 then
        begin
            n := n div 10;
        end
        else
        begin
            n := n - 1;
        end;
    end;
    write(n);
end.

var a,b:longint;
    i:shortint;
begin
read(a,b);
for i:=1 to b do
    begin
         if a mod 10 =0 then a:=a div 10
         else a:=a-1;
    end;
writeln(a);
readln
end.

var n,k,i:longint;
begin
    readln(n,k);
    for i:=1 to k do
        if n mod 10<>0 then
            n:=n-1
        else
            n:=n div 10;
    write(n);
end.

Var
    n, k: Integer;

Begin
    Read(n, k);
    For Var i := 1 to k do
        If n mod 10 = 0 then
            n := n div 10
        Else n -= 1;
    Write(n)
End.

var a,n,k:integer;

begin
 read(n,k);
 for a:=1 to k do begin
  if n mod 10 = 0 then n:=n div 10
   else dec(n);
 end;
 writeln(n);
end.

var a,b,c,v,g,h,n,i:integer;
begin
read(a,b);
for i:=1 to 10000000000 do
begin
if (a mod 10 = 0 ) then
begin
a:=a div 10;
b:=b-1;
end
else
begin
a:=a-1;
b:=b-1;
end;
if (b=0) then break;
end;
write(a);
end.

var n,k:integer;
begin

  readln(n,k);
  for var i:=1 to k do
    if n mod 10 = 0 then n:=n div 10
      else n-=1;

  writeln(n);

end.

var n, k, i: integer;
BEGIN
read(n, k);
for i:=1 to k do begin
if n mod 10 <> 0 then
n:=n-1 else
n:=n div 10;
end;
write(n);
END.

var k,n,i:integer;
begin
 readln(n,k);
 for i:=1 to k do begin
     if n mod 10 <> 0 then n := n - 1
        else n := n div 10;
 end;
 writeln(n);
end.

var
    a,b,i:longint;
begin
read(a,b);
for i:=1 to b do
    if a mod 10 <> 0 then
        a:=a-1
    else
        a:=a div 10;
writeln(a);
end.

var n,k:longint;
begin
     readln(n,k);
     while k>0 do
     begin
          if n mod 10=0 then n:=n div 10 else n:=n-1;
          k:=k-1;
     end;
     writeln(n);
end.

var n:longint;
    i,k:byte;
begin
  readln(n,k);
  for i:=1 to k do
     if n mod 10 = 0 then n:=n div 10 else n:=n-1;
  writeln(n);
  readln;
end.

var
 n,k:int64;
begin
 readln(n,k);
 while k>0 do
  begin
   if n mod 10<>0 then n:=n-1
                             else n:=n div 10;
   dec(k);
  end;
 writeln(n);
end.

uses math;
var f,g:text; n,i,m:longint;
begin
        assign(f,''); reset(f);
        assign(g,''); rewrite(g);
        read(f,m,n);
        for i:=1 to n do
        begin
                if m mod 10=0 then m:=m div 10
                else dec(m);
        end; write(g,m);
        close(f); close(g);
end.

program pitux;
var a,n,k:longint; i:shortint;
begin
read(n,k);
for i:= 1 to k do begin
a:= n;
if a mod 10 = 0 then
n:= n div 10
else
n:= n - 1;
end;
write(n);

end.

var
  n, k: integer;

begin
  read(n, k);
  while k > 0 do
    begin
      if n mod 10 > 0 then
        n := n - 1
      else
        n := n div 10;
      k := k - 1;
    end;
  write(n);
end.

var
        n,m:int64;
        i:longint;

begin
        readln(n,m);
        for i := 1 to m do
        begin
                if n mod 10 > 0 then dec(n) else n := n div 10;
        end;
        writeln(n);
end.

Var n,k,i : longint;
Begin
  Readln(n,k);
  for i:=1 to k do
    if n mod 10=0 then n:=n div 10
                  else n:=n-1;
  writeln(n);

end.

var n,m,i:longint;
begin
readln(n,m);
for i:=1 to m do
  if n mod 10=0 then n:=n div 10 else dec(n);
writeln(n);
end.

Var
k: byte;
n: longint;

Begin
readln(n, k);
repeat
if ((n mod 10)<=k) and (n mod 10<>0) then begin k:=k-(n mod 10); n:=(n-(n mod 10)) end
else if ((n mod 10) =0) and (k<>0) then begin n:=n div 10; dec(k); end
else begin n:=n-k; k:=0; end;
until k=0;
writeln(n);
End.

program WRONG_SUBTRACTION;
var k,i,n1:byte;
    n:longint;
begin
  readln(n,k);
 for i:=1 to k do
     begin
      n1:=n mod 10;
      if n1 = 0 then n:=n div 10
      else dec(n);
     end;
  Writeln(n);
  readln;
end.

var
  n, k,i: integer;

begin
  read(n, k);
  for i := 1 to k do
    if n mod 10 = 0 then
      n := n div 10
    else
      n := n - 1;
  write(n)
end.

var
n,k,i : longint;
begin
readln(n,k);
for i := 1 to k do if n mod 10 = 0 then n:=n div 10 else n:=n-1;
writeln(n);
end.

var
n,i,k:int64;
begin
  read(n,k);
  for i:=1 to k do
    if n mod 10 =0 then n:=n div 10 else n:=n-1;
  write(n);
end.

var n, k, i : integer;
Begin
Read(n, k);
for i := 1 to k do
begin
if n mod 10 <> 0 then n:= n - 1
else n:= n div 10;
end;
writeLn(n);
end.

var
    n,k,i: longint;
begin
read(n,k);
for i:=1 to k do begin
  if (n mod 10 =0) then
    n:=n div 10
  else
    n:=n-1;
end;
write(n);
end.

program fd;
var
  n:real;
  k:byte;
begin
  readln(n,k);
  for i:byte:=1 to k do
  begin
    if (n-Trunc(n/10)*10)<>0 then n-=1 else n:=n/10;
  end;
  Writeln(n);
end.

Program Wrong_subtraction;
var
n, k, i: integer;
begin
  readln(n, k);
  i:= 0;
  while i < k do
    begin
      if n mod 10 = 0 then
        n:= n div 10
      else
        n:= n - 1;
      i := i+1;
    end;
  writeln(n);
end.

program p3;
var
  n,k,r,c : longint;
begin
  readln(n,k);
  for c:=1 to k do
    begin
      r:=n mod 10;
      if r=0 then
        begin
          n:=n div 10;
        end
      else
        begin
          n:=n-1;
        end;
    end;
  writeln(n);
end.

Var a, b:int64;
begin
  read(a, b) ;
  Repeat
  If a mod 10=0 then a:=a div 10
  Else a:=a-1;
  B:=b-1;
  Until b=0;
  Writeln(a) ;
end.

var n,k,i:integer;
begin
 read(n,k);
 for i:=1 to k do
 begin
 if n mod 10=0 then
 begin
 n:=n div 10;
 continue;
 end;
 n:=n-1;
 end;
 write(n);
 end.

var n,k:longint;
begin
    read(n,k);
    for k:=1 to k do
        if n mod 10<>0 then
            n:=n-1
        else
            n:=n div 10;
    write(n);
end.

var
n:longint;
m,k:integer;
begin
read(n);
read(k);
m:=0;
while m<k do
begin
if n mod 10 = 0  then n:= n div 10
else n:=n-1;
m:=m+1;
end;
write(n);
end.

var n,k,s:integer;
begin
readln(n,k);
s:=1;
while (s<=k) do
   begin
   if (n mod 10 = 0) then n:=n div 10
   else n:=n-1;
   s:=s+1;
   end;
 writeln(n);
 end.

program hg;
var n:int64;
       k,i:integer;
 begin
   read(n,k);
   for i:=1 to k do begin
       if n mod 10 <>0 then n:= n-1
       else n:=n div 10;
   end;
   write(n);
 end.

var
  n1, n2, i, x: integer;

begin
  read(n1, n2);
  for i := 1 to n2 do
    if n1 mod 10 = 0 then
      n1:=n1 div 10
    else
      n1 := n1 - 1;

  writeln(n1);
end.

PROGRAM THIRD;

VAR
  N,K:INTEGER;

BEGIN;
  READLN(N,K);
    REPEAT
    begin;
      IF N MOD 10 = 0 THEN N:=N DIV 10 ELSE N:=N-1;
    end;
    K:=K-1;
    UNTIL K=0;
   WRITELN(N);
END.

var n,k,i:integer;
begin
	read(n,k);
	for i:=1 to k do
	begin
		if (n mod 10)=0 then
			begin
			n:=n div 10;
			continue;
			end;
		if (n mod 10)<>0 then
			begin
			n:=n-1;
			continue;
			end;
	end;
	writeln(n);
	end.

var
a,b,d:longint;
begin
read(a,b);
d:=0;
while d < b  do
begin
if a mod  10 = 0 then
a:=a div 10
else
a:=a-1;
d:=d+1;
end;
writeln(a);
end.

program Tanya;
var n, k, i, res : Integer;
begin
Read(n, k);
for k := k downto 1 do
begin
if n mod 10 = 0 then
n := n div 10
else n := n - 1;
end;
Write(n);
end.

{Маленькая девочка Таня учится уменьшать числа на единицу, но она делает это неправильно с числами, состоящими из нескольких цифр. Таня вычитает единицу из числа по следующему алгоритму:

если последняя цифра числа не равна нулю, она уменьшает число на единицу;
если последняя цифра числа равна нулю, она делит число на 10 (то есть удаляет его последнюю цифру).
Вам задано целое число n. Таня хочет вычесть из него единицу k раз. Ваша задача вывести результат после всех k вычитаний.

Гарантируется, что ответ будет являться целым положительным числом.}
Var n,k:integer;
    i: byte;
Begin
Readln(n,k);
For i:=1 to k do
begin
If (n mod 10)=0 then
n:=n div 10
Else
n:=n-1;
end;
Writeln(n);
End.

var a,i,o,j:integer;
begin

readln(j,a);
for i:=1 to a do
begin
o:=j mod 10;
if (o = 0) then
j:=j div 10
else
j:=j-1;

end;
writeln(j);
end.

var n,i,a,k:integer;
begin

    read(n); read(k);

    for i:=1 to k do
    begin
        if (n mod 10 <> 0) then n:=n-1
        else if (n mod 10 = 0) then n:=n div 10;
        end;
    writeln(n);

end.

var n,k:longint;
begin
read(n,k);
while k<>0 do
begin
if n mod 10=0 then n:=n div 10
else n:=n-1;
dec(k);
end;
write(n);
end.

program N1;
var a,b,i:int64;
begin
readln(a,b);
for i:=1to b do begin
 if a mod 10 =0 then a:=a div 10 else a:=a-1;
 end;
writeln(a);
end.

var b,c,d,e,df,j,k,g,m,n,i:longint;
begin
        readln(b,c);
        for i:=1 to c do
        begin
                if(b mod 10=0) then
                begin
                        b:=b div 10;
                        continue;
                end;
                b:=b-1;
        end;
        writeln(b);
end.

var
a,i,c : integer;
begin
read(a,i);
for c:=0 to i-1 do
begin
if ( a mod 10 )=0 then
a:=a div 10
else
a:=a-1;
end;
writeln(a);
end.

var a,b,i:integer;
begin
    read(a,b);
    for i:=1 to b do begin
        if a mod 10 <> 0 then begin
            a:=a-1
        end else
            a:=a div 10;
        end;
    write(a);
end.

var a,k,n,p:integer;
begin
readln(n,k);
for a:= 1 to k do
begin
if n mod 10=0 then n:=n div 10
else n:=n-1;
end;
writeln(n);
readln;
end.

var i,n,k:longint;
    a:array[1..100000] of longint;
begin
    readln(n,k);
    while k>0 do
    begin
        if (n mod 10)<>0 then dec(n)
        else n:=n div 10;
        dec(k);
    end;
    write(n);
    //readln;
end.

program vichitanie;
var n:int64;
i,k:integer;
begin
i:=0;
read(n,k);
while i<k do
begin
if n mod 10>0 then n-=1
else n:=n div 10;
i+=1;
end;
writeln(n);
end.

var I,N:byte;k:longint;

begin
read(k,n);
for i:=1 to n do
 if k mod 10=0 then k:=k div 10 else k:=k-1;
write(k);
END.

var a,b,q:longint;

begin
readln(a,b);
while b<>0 do
begin
if a<10 then begin a:=a-b; writeln(a); halt; end;
if a mod 10 =0 then begin a:=a div 10; dec(b) end else
begin
q:=a mod 10;
if q>b then q:=b;
a:=a-q;
b:=b-q;

end;
end;

writeln(a);
end.

var n,k,i: longint;

begin
    readln(n,k);
    for i := 1 to k do if n mod 10 = 0 then n := n div 10 else dec(n,1);
    write(n);
end.

var
a,b,c,d:integer;
begin
   read(a,b);

   while b>0 do
   begin
      if (A mod 10>0) then a:=a-(a mod 10)
                      else if (a mod 10=0) then a:=a div 10;
                      b:=b-1;
   end;
   write(a)
end.

var
i, k : integer; n: longint;
begin
read (n, k);
for i:=1 to k do if n mod 10<>0 then n:=n-1 else n:=n div 10;
write ('n ', n);
end.

program v;
var i, k, n: integer;
begin
write ('n ');
read (n);
write ('k ');
read (k);
for i:=1 to k do
if n mod 10<>0 then n:=n-1 else n:=n div 10;
write ('n ', n);
end.

var
i, k : integer; n: longint;
begin
write ('n ');
read (n);
write ('k ');
read (k);
for i:=1 to k do if n mod 10<>0 then n:=n-1 else n:=n div 10;
write ('n ', n);
end.

var
	i, n, k,q: integer;

begin
	read(n, k);

	for i := 1 to k do
	q:=n mod 10;
	if q <> 0 then q := q-1 else q := q div 10;

	writeln(q);

end.

var
	i, n, k,q: integer;

begin
	read(n, k);

	for i := 1 to k do
	begin
	q:=n mod 10;
	if q <> 0 then q := q-1 else q := q div 10;
	end;

	writeln(q);

end.

var
i, k : integer; n: longint;
begin
write ('n ');
read (n);
write ('k ');
read (k);
for i:=1 to k do
begin
if (n mod 10<>0) then n:=n-1 else n:=n div 10;
end;
write ('n ', n);
end.

Program Wrong_subtraction;
var
n, k, i: integer;
begin
  writeln('Введите число для вычитания и колличество вычитаний.');
  readln(n, k);
  i:= 0;
  while i < k do
    begin
      if n mod 10 = 0 then
        n:= n div 10
      else
        n:= n - 1;
      i := i+1;
    end;
  writeln(n);
end.

program abc;
var n:integer; i,k:integer; s:string;
Begin
   read(n);
   readLn(k);
   for i:= 1 to k do
   Begin
      Str(n,s);
      if s[length(s)-1] = '0' then n:=n div 10
      else Dec(n);
   End;
   writeLn(n);
End.

var
n:longint;
m,k:integer;
begin
write('введите число n');
read(n);
read(k);
m:=0;
while m<k do
begin
if n mod 10 > 0  then n:=n-1
else n:= n div 10;
m:=m+1;
end;
write(n);
end.

var
n:longint;
m,k:integer;
begin
write('введите число n');
read(n);
read(k);
m:=0;
while m<k do
begin
if n mod 10 = 0  then n:= n div 10
else n:=n-1;
m:=m+1;
end;
write(n);
end.

var
  s: string;
  k: integer;
  buffer: integer;

begin
  readln(s);
  k := StrToInt(Copy(s, pos(' ', s), length(s)));
  Delete(s,pos(' ',s), length(s));
  writeln(s, ' ', k);
  while(k <> 0) do
  begin
    if s[length(s)] <> '0' then
    begin
      buffer := s.ToInteger;
      dec(buffer);
      s := buffer.ToString;
      dec(k);
    end
    else if s[length(s)] = '0' then
      begin
        s := Copy(s, 1, length(s) - 1);
        dec(k);
      end;
  end;

  writeln(s);
end.

const   f1='977a.inp';
        f2='977a.out';
var     a,b:longint;

begin
        //assign(input,f1);reset(input);
        //assign(output,f2);rewrite(output);
        read(a,b);
        while b>0 do
        begin
                if (a mod 10=0) then dec(a,10) else dec(a);
                dec(b);
        end;
        writeln(a);
end.

var n, k, i:integer;
begin
    readln(n);
    readln(k);
    for i:=1 to k do
    begin
        if (n mod 10 = 0) then n:= n div 10 else
        n:=n-1;
    end;
    writeln(n);
end.

program Project1;
 Uses sysutils;
var
 chis,chis1,chis2:string;
 a,b:integer;
begin

     readln(chis);
     chis1:=Copy(chis, 1, Pos(' ' ,chis)-1);
      chis2:=Copy(chis, Pos(' ' ,chis)+1, Length(chis));
a:=strtoint(chis1);
b:=strtoint(chis2);

writeln('a=',a,', b=',b);
while (b>0) do
begin

if ((a mod 10)<>0)  then a:=a-1 else a:=a div 10;
dec(b);
end;
   writeln(a);

end.

Var n:longint;
    k,i:integer;
begin
 read(n,k);
 for i:=1 to k do
  if (n mod 10) = 0
  then n:=n mod 10
  else n:=n-1;
 writeln(n);
 readln;
end.

Var n:longint;
    k,i:integer;
begin
 read(n,k);
 for i:=1 to k do
  if (n div 10) = 0
  then n:=n div 10
  else n:=n-1;
 writeln(n);
 readln;
end.

var a,k,i:integer;
begin
 readln(a,k);
 for i:=1 to k do
  if a mod 10<>0 then
   begin
    a:=a-1;
    write(a,' ');
   end
  else
   begin
    a:=a div 10;
    write(a,' ');
   end;
 readln;
end.

program untitled;
var
n :integer;
i:integer;
a:longint;

//WARNING
begin
readln(a);
readln(n);

for i:=1 to n do
if (a mod 10 = 0) then a :=a div 10
else
a:=a-1;

writeln(a);

END.

var
	i,n,k:longint;

begin
	readln(n,k);
	for i:=1 to k do
		begin
			if (n mod 10<>0) then inc(n)
				else n:=n div 10;
		end;
	writeln(n);

end.

var
  a, b, i, j: longint;
  s: string;

begin
  readln(a, b);
  while b > 0 do
  begin
  if (a mod 10 <> 0) then
    begin
    i := a mod 10;
    a := a - i;
    b := b - i;
    end
    else
    begin
    a := a div 10;
    b := b - 1;
    end;
  end;
  writeln(a);
end.

var
  i,n,k:longint;
begin
  readln(n,k);
  for i:=1 to k do
   if n mod 10=0 then n:=n div 10
                 else n:=n-1;
end.

var x,y: longint;
begin
 readln(x,y);
 writeln(x-y);
end.

PROGRAM THIRD;

VAR
  N,K:INTEGER;

BEGIN;
  READLN(N,K);
    FOR K:=K TO 0 DO
    begin;
      IF N MOD 10 = 0 THEN N:=N DIV 10 ELSE N:=N-1;
    end;
   WRITELN(N);
END.

{Маленькая девочка Таня учится уменьшать числа на единицу, но она делает это неправильно с числами, состоящими из нескольких цифр. Таня вычитает единицу из числа по следующему алгоритму:

если последняя цифра числа не равна нулю, она уменьшает число на единицу;
если последняя цифра числа равна нулю, она делит число на 10 (то есть удаляет его последнюю цифру).
Вам задано целое число n. Таня хочет вычесть из него единицу k раз. Ваша задача вывести результат после всех k вычитаний.

Гарантируется, что ответ будет являться целым положительным числом.}
Var n:integer;
    k,i: byte;
Begin
Read(n,k);
If (((n<=2) and (n<1000000000)) and ((k>=1) and (k<50)))=false then
begin
For i:=1 to k do
begin
If (n mod 10)=0 then
n:=n div 10
Else
n:=n-1;
end;
Writeln(n);
end
Else Writeln('Неверное число');
End.

{Маленькая девочка Таня учится уменьшать числа на единицу, но она делает это неправильно с числами, состоящими из нескольких цифр. Таня вычитает единицу из числа по следующему алгоритму:

если последняя цифра числа не равна нулю, она уменьшает число на единицу;
если последняя цифра числа равна нулю, она делит число на 10 (то есть удаляет его последнюю цифру).
Вам задано целое число n. Таня хочет вычесть из него единицу k раз. Ваша задача вывести результат после всех k вычитаний.

Гарантируется, что ответ будет являться целым положительным числом.}
Var n:integer;
    k,i: byte;
Begin
Read(n,k);
If (((n<=2) and (n<=1000000000)) and ((k>=1) and (k<=50)))=false then
begin
For i:=1 to k do
begin
If (n mod 10)=0 then
n:=n div 10
Else
n:=n-1;
end;
Writeln(n);
end
Else Writeln('Неверное число');
End.


{$A8,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O+,P+,Q-,R-,S-,T-,U-,V+,W-,X+,Y+,Z1}
{$MINSTACKSIZE $00004000}
{$MAXSTACKSIZE $00100000}
{$IMAGEBASE $00400000}
{$APPTYPE CONSOLE}

const filename='b';
      oo=maxlongint div 2;
      eps=1e-6;
      eee=1e-21;

var x,y,z,xx,yy,zz,x0,y0,z0,x1,x2,x3,z1,z2,z3,rr:extended;
    p2,y1,y2,y3:extended;
    nt,ii,jj,n,m,q,c,q0,c0,q1,c1,q2,c2,q3,c3:longint;
    nn,mm,kk,u,v,res,cur,max,min:longint;
    test,ll,t,tt:longint;
    b,bb,bbb,b0,b1,b2,b3:boolean;

function mx(q,c:longint):longint;
  begin
  if q>c then mx:=q else mx:=c;
  end;

function mn(q,c:longint):longint;
  begin
  if q<c then mn:=q else mn:=c;
  end;

procedure init;
  begin
  assign(input,filename+'.in');
  assign(output,filename+'.out');
  reset(input);
  rewrite(output);
  end;

procedure fin;
  begin
  close(input);
  close(output);
  end;

procedure clear;
var i,j,k:longint;
  begin
  end;

procedure load;
var i,j,k:longint;
  begin
  end;

procedure save;
var i,j,k:longint;
  begin
  end;

function sinus(x:extended):extended;
var ss,nu,de:extended;
    i:longint;
    begin
    ss:=x;
    de:=1.0;
    nu:=x;
    for i:=1 to 10 do
      begin
      nu:=nu*x*x;
      de:=de*(2*i+1)*(2*i);
      if odd(i) then ss:=ss-nu/de else ss:=ss+nu/de;
      end;
    sinus:=ss;
    end;

procedure run;
var i,j,k:longint;
  begin
  //init;
  read(n,u,v);
  p2:=2*pi;
  for i:=1 to n do
    begin
    read(x1,x2);
    xx:=(x2-x1)/u;
    rr:=trunc(xx/p2);
    xx:=0.5*(xx-p2*rr);
    y1:=0;
    y2:=pi;
    for j:=1 to 55 do
      begin
      y3:=0.5*(y1+y2);
      if sinus(y3)<xx-y3 then y1:=y3 else y2:=y3;
      end;
    rr:=rr+2*y1/p2;
    writeln(p2*rr*u/v:0:12);
    end;

  //fin;
  end;

begin
nt:=1;
//readln(nt);
for test:=1 to nt do
  begin
  clear;
  load;
  run;
  save;
  end;
end.

{$A8,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O+,P+,Q-,R-,S-,T-,U-,V+,W-,X+,Y+,Z1}
{$MINSTACKSIZE $00004000}
{$MAXSTACKSIZE $00100000}
{$IMAGEBASE $00400000}
{$APPTYPE CONSOLE}

const filename='b';
      oo=maxlongint div 2;
      eps=1e-6;
      eee=1e-21;

var x,y,z,xx,yy,zz,x0,y0,z0,x1,x2,x3,y1,y2,y3,z1,z2,z3,rr:extended;
    nt,ii,jj,n,m,q,c,q0,c0,q1,c1,q2,c2,q3,c3:longint;
    nn,mm,kk,u,v,res,cur,max,min:longint;
    test,ll,t,tt:longint;
    b,bb,bbb,b0,b1,b2,b3:boolean;

function mx(q,c:longint):longint;
  begin
  if q>c then mx:=q else mx:=c;
  end;

function mn(q,c:longint):longint;
  begin
  if q<c then mn:=q else mn:=c;
  end;

procedure init;
  begin
  assign(input,filename+'.in');
  assign(output,filename+'.out');
  reset(input);
  rewrite(output);
  end;

procedure fin;
  begin
  close(input);
  close(output);
  end;

procedure clear;
var i,j,k:longint;
  begin
  end;

procedure load;
var i,j,k:longint;
  begin
  end;

procedure save;
var i,j,k:longint;
  begin
  end;

procedure run;
var i,j,k:longint;
  begin
  //init;
  read(n,u,v);
  for i:=1 to n do
    begin
    read(x1,x2);
    xx:=(x2-x1)/u;
    rr:=trunc(xx/(2*pi));
    xx:=(xx-2*pi*rr)/2;
    y1:=0;
    y2:=pi;
    for j:=1 to 55 do
      begin
      y3:=0.5*(y1+y2);
      if y3+sin(y3)<xx then y1:=y3 else y2:=y3;
      end;
    rr:=rr+2*y1/(2*pi);
    writeln(2*pi*rr*u/v:0:12);
    end;

  //fin;
  end;

begin
nt:=1;
//readln(nt);
for test:=1 to nt do
  begin
  clear;
  load;
  run;
  save;
  end;
end.

{$A8,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O+,P+,Q-,R-,S-,T-,U-,V+,W-,X+,Y+,Z1}
{$MINSTACKSIZE $00004000}
{$MAXSTACKSIZE $00100000}
{$IMAGEBASE $00400000}
{$APPTYPE CONSOLE}

const filename='b';
      oo=maxlongint div 2;
      eps=1e-6;
      eee=1e-21;

var x,y,z,xx,yy,zz,x0,y0,z0,x1,x2,x3,z1,z2,z3,rr:real;
    p2,y1,y2,y3:real;
    nt,ii,jj,n,m,q,c,q0,c0,q1,c1,q2,c2,q3,c3:longint;
    nn,mm,kk,u,v,res,cur,max,min:longint;
    test,ll,t,tt:longint;
    b,bb,bbb,b0,b1,b2,b3:boolean;

function mx(q,c:longint):longint;
  begin
  if q>c then mx:=q else mx:=c;
  end;

function mn(q,c:longint):longint;
  begin
  if q<c then mn:=q else mn:=c;
  end;

procedure init;
  begin
  assign(input,filename+'.in');
  assign(output,filename+'.out');
  reset(input);
  rewrite(output);
  end;

procedure fin;
  begin
  close(input);
  close(output);
  end;

procedure clear;
var i,j,k:longint;
  begin
  end;

procedure load;
var i,j,k:longint;
  begin
  end;

procedure save;
var i,j,k:longint;
  begin
  end;

procedure run;
var i,j,k:longint;
  begin
  //init;
  read(n,u,v);
  p2:=2*pi;
  for i:=1 to n do
    begin
    read(x1,x2);
    xx:=(x2-x1)/u;
    rr:=trunc(xx/p2);
    xx:=0.5*(xx-p2*rr);
    y1:=0;
    y2:=pi;
    for j:=1 to 55 do
      begin
      y3:=0.5*(y1+y2);
      if sin(y3)<xx-y3 then y1:=y3 else y2:=y3;
      end;
    rr:=rr+2*y1/p2;
    writeln(p2*rr*u/v:0:12);
    end;

  //fin;
  end;

begin
nt:=1;
//readln(nt);
for test:=1 to nt do
  begin
  clear;
  load;
  run;
  save;
  end;
end.

{$A8,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O+,P+,Q-,R-,S-,T-,U-,V+,W-,X+,Y+,Z1}
{$MINSTACKSIZE $00004000}
{$MAXSTACKSIZE $00100000}
{$IMAGEBASE $00400000}
{$APPTYPE CONSOLE}

const filename='b';
      oo=maxlongint div 2;
      eps=1e-6;
      eee=1e-21;

var x,y,z,xx,yy,zz,x0,y0,z0,x1,x2,x3,z1,z2,z3,rr:extended;
    p2,y1,y2,y3:extended;
    nt,ii,jj,n,m,q,c,q0,c0,q1,c1,q2,c2,q3,c3:longint;
    nn,mm,kk,u,v,res,cur,max,min:longint;
    test,ll,t,tt:longint;
    b,bb,bbb,b0,b1,b2,b3:boolean;

function mx(q,c:longint):longint;
  begin
  if q>c then mx:=q else mx:=c;
  end;

function mn(q,c:longint):longint;
  begin
  if q<c then mn:=q else mn:=c;
  end;

procedure init;
  begin
  assign(input,filename+'.in');
  assign(output,filename+'.out');
  reset(input);
  rewrite(output);
  end;

procedure fin;
  begin
  close(input);
  close(output);
  end;

procedure clear;
var i,j,k:longint;
  begin
  end;

procedure load;
var i,j,k:longint;
  begin
  end;

procedure save;
var i,j,k:longint;
  begin
  end;

function sinus(x:extended):extended;
var ss,nu,de:extended;
    i:longint;
    begin
    ss:=x;
    de:=1.0;
    nu:=x;
    for i:=1 to 8 do
      begin
      nu:=nu*x*x;
      de:=de*(2*i+1)*(2*i);
      if odd(i) then ss:=ss-nu/de else ss:=ss+nu/de;
      end;
    sinus:=ss;
    end;

procedure run;
var i,j,k:longint;
  begin
  //init;
  read(n,u,v);
  p2:=2*pi;
  for i:=1 to n do
    begin
    read(x1,x2);
    xx:=(x2-x1)/u;
    rr:=trunc(xx/p2);
    xx:=0.5*(xx-p2*rr);
    y1:=0;
    y2:=pi;
    for j:=1 to 55 do
      begin
      y3:=0.5*(y1+y2);
      if sinus(y3)<xx-y3 then y1:=y3 else y2:=y3;
      end;
    rr:=rr+2*y1/p2;
    writeln(p2*rr*u/v:0:12);
    end;

  //fin;
  end;

begin
nt:=1;
//readln(nt);
for test:=1 to nt do
  begin
  clear;
  load;
  run;
  save;
  end;
end.

uses math;
type real=extended;
	 int=longint;
var r,v: real;

function cosine(x: real): real;
var kq,kq1,k,this: real;
	i: int;
begin
	x:=x-trunc(x/(2*pi))*2*pi;
	kq1:=r*r;
    kq:=0;
    this:=r*r;
    k:=1;
    i:=1;
    repeat
    	kq:=kq1;
    	this:=this*x/k*x/(k+1);
        k:=k+2;
        if odd(i) then kq1:=kq-this
        else kq1:=kq+this;
        inc(i);
    until abs(kq-kq1)<=1e-22;
    exit(kq1);
end;

function calc(a: real): real;
var d,c,x: real;
begin
    d:=max(0,(a-2*r)/v);
    c:=a/v;
    repeat
    	x:=(d+c)/2;
        if sqr(a-v*x)<=2*r*r-2*cosine(x*(v/r)) then c:=x
        else d:=x;
    until abs(d-c)/max(1,d)<=1e-7;
    exit(d);
end;

procedure main();
var n,i: int;
	a,b: real;
begin
	readln(n,r,v);
    for i:=1 to n do begin
    	readln(a,b);
        writeln(calc(b-a):0:6);
    end;
end;

begin
main();
end.

{$A8,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O+,P+,Q-,R-,S-,T-,U-,V+,W-,X+,Y+,Z1}
{$MINSTACKSIZE $00004000}
{$MAXSTACKSIZE $00100000}
{$IMAGEBASE $00400000}
{$APPTYPE CONSOLE}

const filename='b';
      oo=maxlongint div 2;
      eps=1e-6;
      eee=1e-21;

var x,y,z,xx,yy,zz,x0,y0,z0,x1,x2,x3,z1,z2,z3,rr:extended;
y1,y2,y3:real;
    nt,ii,jj,n,m,q,c,q0,c0,q1,c1,q2,c2,q3,c3:longint;
    nn,mm,kk,u,v,res,cur,max,min:longint;
    test,ll,t,tt:longint;
    b,bb,bbb,b0,b1,b2,b3:boolean;

function mx(q,c:longint):longint;
  begin
  if q>c then mx:=q else mx:=c;
  end;

function mn(q,c:longint):longint;
  begin
  if q<c then mn:=q else mn:=c;
  end;

procedure init;
  begin
  assign(input,filename+'.in');
  assign(output,filename+'.out');
  reset(input);
  rewrite(output);
  end;

procedure fin;
  begin
  close(input);
  close(output);
  end;

procedure clear;
var i,j,k:longint;
  begin
  end;

procedure load;
var i,j,k:longint;
  begin
  end;

procedure save;
var i,j,k:longint;
  begin
  end;

procedure run;
var i,j,k:longint;
  begin
  //init;
  read(n,u,v);
  for i:=1 to n do
    begin
    read(x1,x2);
    xx:=(x2-x1)/u;
    rr:=trunc(xx/(2*pi));
    xx:=(xx-2*pi*rr)/2;
    y1:=0;
    y2:=pi;
    for j:=1 to 55 do
      begin
      y3:=0.5*(y1+y2);
      if y3+sin(y3)<xx then y1:=y3 else y2:=y3;
      end;
    rr:=rr+2*y1/(2*pi);
    writeln(2*pi*rr*u/v:0:12);
    end;

  //fin;
  end;

begin
nt:=1;
//readln(nt);
for test:=1 to nt do
  begin
  clear;
  load;
  run;
  save;
  end;
end.

{$A8,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O-,P+,Q-,R+,S+,T-,U-,V+,W-,X+,Y+,Z1}
{$MINSTACKSIZE $00004000}
{$MAXSTACKSIZE $00100000}
{$IMAGEBASE $00400000}
{$APPTYPE CONSOLE}

const filename='b';
      oo=maxlongint div 2;
      eps=1e-6;
      eee=1e-21;

var qq,cc,a,aa:array[0..1000000]of longint;
    qc,he:array[0..2014,0..2014]of longint;
    s,ss,sss,s0,s1,s2,s3:string;
    x,y,z,xx,yy,zz,x0,y0,z0,x1,x2,x3,y1,y2,y3,z1,z2,z3,rr:extended;
    nt,ii,jj,n,m,q,c,q0,c0,q1,c1,q2,c2,q3,c3:longint;
    nn,mm,kk,u,v,res,cur,max,min:longint;
    test,ll,t,tt:longint;
    b,bb,bbb,b0,b1,b2,b3:boolean;

function mx(q,c:longint):longint;
  begin
  if q>c then mx:=q else mx:=c;
  end;

function mn(q,c:longint):longint;
  begin
  if q<c then mn:=q else mn:=c;
  end;

procedure init;
  begin
  assign(input,filename+'.in');
  assign(output,filename+'.out');
  reset(input);
  rewrite(output);
  end;

procedure fin;
  begin
  close(input);
  close(output);
  end;

procedure clear;
var i,j,k:longint;
  begin
  fillchar(qc,sizeof(qc),0);
  end;

procedure load;
var i,j,k:longint;
  begin
  end;

procedure save;
var i,j,k:longint;
  begin
  end;

procedure run;
var i,j,k:longint;
  begin
  //init;
  read(n,u,v);
  for i:=1 to n do
    begin
    read(x1,x2);
    xx:=(x2-x1)/u;
    rr:=trunc(xx/(2*pi));
    xx:=(xx-2*pi*rr)/2;
    y1:=0;
    y2:=pi;
    for j:=1 to 60 do
      begin
      y3:=0.5*(y1+y2);
      if y3+sin(y3)<xx then y1:=y3 else y2:=y3;
      end;
    rr:=rr+2*y1/(2*pi);
    writeln(2*pi*rr*u/v:0:12);
    end;

  //fin;
  end;

begin
nt:=1;
//readln(nt);
for test:=1 to nt do
  begin
  clear;
  load;
  run;
  save;
  end;
end.

   {$APPTYPE CONSOLE}
const nn=1000001; besk=200000000000000;
   nnn=2000000;  eps=1e-6; modul=1000000007;
 label 1,2,3,4;
var ii,jj,kt,ppp,god,day,mon,p,mask,i0,j0,k,i,j,start,finish,kol,m:longint;
step,pos,p1,p2,ll,bb,pp,tt,ot1,ot2,s,kold,gr,n,kolshok:int64;
ot,dist1,avt,zap,q,ba,by,aa,ay,t,kk,centr,koef:int64;
flag2,flag1,flag:boolean;
ch1,ch2,ch:char;
ccc1,v,rr,h1,h2,t1,t2,h,r1,r2,aaa,bbb,ccc,hh,po,pt,doltek,dolpred:extended;
dd,y,fact,x,c,b,a,prost:array[0..1000000] of extended;
oldmarked,marked,zan: array[0..330006] of boolean;
per: array[0..4000,0..4000] of int64;
ott :double;
ss1,ss2:string;
ss:array[0..10000] of string;
pole:array[-10..110,-10..100] of char;
name:array[0..2000] of string;
function min (a,b:int64):int64;begin min:=b;if a<b then min:=a;  end;
function max (a,b:int64):int64;begin max:=b;if a>b then max:=a;  end;

 function nod(x,y:int64):int64; var z:int64;
begin   repeat  z:=x mod y;x:=y;y:=z;   until  z=0 ;  nod:=x;end;

function  koldel(p,mmod:int64):int64; var pp,ot:int64;
begin  koldel:=(p+mmod) div mmod; end;

function dist(phi:extended):extended;
begin phi:=phi*v/rr; dist:=rr*phi+rr*(sin(phi)-0);   end;

function ddist(phi:extended):extended;
begin  phi:=phi*v/rr; ddist:=rr*phi-rr*(sin(phi)-0);   end;

begin
 { assign (input,'input.txt');reset(input);
      assign (output,'output.txt'); rewrite(output);
  }

 read(n,rr,v);
 for i:=1 to n do read(a[i],b[i]);

 { for i:=0 to 1000 do writeln(i/100:0:3,' ',dist(i/100):0:5);
  }
     for i:=1 to n do
        begin
           aaa:=0; bbb:=1e+10;
          { a[i]:=a[i]/rr; b[i]:=b[i]/rr;
          }
           while abs(aaa-bbb)>1e-7 do
             begin
                ccc:=(aaa+bbb)/2;
                if dist(ccc)>(b[i]-a[i])/2 then bbb:=ccc else aaa:=ccc;
              {  writeln(ccc:0:9,' ',dist(ccc):0:9);
               }
             end;
        { writeln(2*ccc/v:0:8,' ',dist(ccc):0:7);
         }
         ccc1:=ccc;
           aaa:=0; bbb:=1e+10;
           while abs(aaa-bbb)>1e-7 do
             begin
                ccc:=(aaa+bbb)/2;
                if ddist(ccc)>(b[i]-a[i])/2 then bbb:=ccc else aaa:=ccc;
              {  writeln(ccc:0:9,' ',ddist(ccc):0:9);
            } end;
        { writeln(2*ccc/v:0:8,' ',dist(ccc):0:7);
         }
           { ccc1:=rr*2*ccc1/v; ccc:=rr*2*ccc/v;
            writeln(ccc:0:10,' ==  ',ccc1:0:10);
           }
           if ccc1<ccc then writeln(ccc1*2:0:8) else writeln(ccc*2:0:8);

        end;

   1:          close(output);
end.

{$A8,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O+,P+,Q-,R-,S-,T-,U-,V+,W-,X+,Y+,Z1}
{$MINSTACKSIZE $00004000}
{$MAXSTACKSIZE $00100000}
{$IMAGEBASE $00400000}
{$APPTYPE CONSOLE}

const filename='b';
      oo=maxlongint div 2;
      eps=1e-6;
      eee=1e-21;

var x,y,z,xx,yy,zz,x0,y0,z0,x1,x2,x3,z1,z2,z3,rr:real;
    p2,y1,y2,y3:real;
    nt,ii,jj,n,m,q,c,q0,c0,q1,c1,q2,c2,q3,c3:longint;
    nn,mm,kk,u,v,res,cur,max,min:longint;
    test,ll,t,tt:longint;
    b,bb,bbb,b0,b1,b2,b3:boolean;

function mx(q,c:longint):longint;
  begin
  if q>c then mx:=q else mx:=c;
  end;

function mn(q,c:longint):longint;
  begin
  if q<c then mn:=q else mn:=c;
  end;

procedure init;
  begin
  assign(input,filename+'.in');
  assign(output,filename+'.out');
  reset(input);
  rewrite(output);
  end;

procedure fin;
  begin
  close(input);
  close(output);
  end;

procedure clear;
var i,j,k:longint;
  begin
  end;

procedure load;
var i,j,k:longint;
  begin
  end;

procedure save;
var i,j,k:longint;
  begin
  end;

procedure run;
var i,j,k:longint;
  begin
  //init;
  read(n,u,v);
  p2:=2*pi;
  for i:=1 to n do
    begin
    read(x1,x2);
    xx:=(x2-x1)/u;
    rr:=trunc(xx/p2);
    xx:=0.5*(xx-p2*rr);
    y1:=0;
    y2:=pi;
    for j:=1 to 55 do
      begin
      y3:=0.5*(y1+y2);
      if y3+sin(y3)<xx then y1:=y3 else y2:=y3;
      end;
    rr:=rr+2*y1/p2;
    writeln(p2*rr*u/v:0:12);
    end;

  //fin;
  end;

begin
nt:=1;
//readln(nt);
for test:=1 to nt do
  begin
  clear;
  load;
  run;
  save;
  end;
end.

uses math;
type real=extended;
	 int=longint;
var r,v: real;

function cosine(x: real): real;
var kq,kq1,k,this: real;
	i: int;
begin
	x:=x-trunc(x/(2*pi))*2*pi;
	kq1:=r*r;
    kq:=0;
    this:=r*r;
    k:=1;
    i:=1;
    repeat
    	kq:=kq1;
    	this:=this*x/k*x/(k+1);
        k:=k+2;
        if odd(i) then kq1:=kq-this
        else kq1:=kq+this;
        inc(i);
    until abs(kq-kq1)<=1e-22;
    exit(kq1);
end;

function calc(a: real): real;
var d,c,x: real;
begin
    d:=max(0,(a-2*r)/v);
    c:=a/v;
    repeat
    	x:=(d+c)/2;
        if sqr(a-v*x)<=2*r*r-2*cosine(x*(v/r)) then c:=x
        else d:=x;
    until abs(d-c)/max(1,d)<=1e-6;
    exit(d);
end;

procedure main();
var n,i: int;
	a,b: real;
begin
	readln(n,r,v);
    for i:=1 to n do begin
    	readln(a,b);
        writeln(calc(b-a):0:9);
    end;
end;

begin
main();
end.

uses math;
type real=extended;
	 int=longint;
var r,v: real;

function z(x: real): real;
begin
	exit(-r*sqrt(2-2*cos(x*(v/r))));
end;

function calc(a: real): real;
var d,c,x: real;
begin
	d:=max(0,(a-2*r)/v);
    c:=a+1;
    repeat
    	x:=(d+c)/2;
        if z(x)<=v*x-a then c:=x
        else d:=x;
    until abs(d-c)/max(1,d)<=1e-6;
    exit(d);
end;

procedure main();
var n,i: int;
	a,b: real;
begin
	readln(n,r,v);
    for i:=1 to n do begin
    	readln(a,b);
        writeln(calc(b-a):0:9);
    end;
end;

begin
main();
end.

uses math;
type int=longint;
var r,v: real;

function z(a: real): real;
begin
    exit(a*(r/v));
end;

function calc(a: real): real;
var l,r,x: real;
begin
    l:=a-5;
    r:=a+5;
    repeat
        x:=(l+r)/2;
        if -sqrt(2-2*cos(x))<=x-a then begin
            r:=x;
        end else begin
            l:=x;
        end;
    until abs(z(r)-z(l))/max(1,z(l))<=1e-6;
    exit(z(r));
end;

procedure main();
var i,n: int;
    a,b: real;
    f: text;
begin
    assign(f,'');reset(f);
    readln(f,n,r,v);
    for i:=1 to n do begin
        readln(f,a,b);
        writeln(calc((b-a)/r):0:9);
    end;
    close(f);
end;

begin
main();
end.

uses math;
type real=extended;
	 int=longint;
var r,v: real;

function calc(a: real): real;
var l,r,x: real;
begin
	l:=max(0,a-3);
    r:=a;
    repeat
    	x:=(l+r)/2;
        if -r*sqrt(2-2*cos(x*(v/r)))<=v*x-a then r:=x
        else l:=x;
    until abs(r-l)/max(1,l)<=1e-6;
    exit(r);
end;

procedure main();
var n,i: int;
	a,b: real;
begin
	readln(n,r,v);
    for i:=1 to n do begin
    	readln(a,b);
        writeln(calc(b-a):0:9);
    end;
end;

begin
main();
end.

   {$APPTYPE CONSOLE}
const nn=1000001; besk=200000000000000;
   nnn=2000000;  eps=1e-6; modul=1000000007;
 label 1,2,3,4;
var ii,jj,kt,ppp,god,day,mon,p,mask,i0,j0,k,i,j,start,finish,kol,m:longint;
step,pos,p1,p2,ll,bb,pp,tt,ot1,ot2,s,kold,gr,n,kolshok:int64;
ot,dist1,avt,zap,q,ba,by,aa,ay,t,kk,centr,koef:int64;
flag2,flag1,flag:boolean;
ch1,ch2,ch:char;
ccc1,v,rr,h1,h2,t1,t2,h,r1,r2,aaa,bbb,ccc,hh,po,pt,doltek,dolpred:extended;
dd,y,fact,x,c,b,a,prost:array[0..1000000] of int64;
oldmarked,marked,zan: array[0..330006] of boolean;
per: array[0..4000,0..4000] of int64;
ott :double;
ss1,ss2:string;
ss:array[0..10000] of string;
pole:array[-10..110,-10..100] of char;
name:array[0..2000] of string;
function min (a,b:int64):int64;begin min:=b;if a<b then min:=a;  end;
function max (a,b:int64):int64;begin max:=b;if a>b then max:=a;  end;

 function nod(x,y:int64):int64; var z:int64;
begin   repeat  z:=x mod y;x:=y;y:=z;   until  z=0 ;  nod:=x;end;

function  koldel(p,mmod:int64):int64; var pp,ot:int64;
begin  koldel:=(p+mmod) div mmod; end;

function dist(phi:extended):extended;
begin  dist:=rr*phi+rr*(sin(phi)-0);   end;

function ddist(phi:extended):extended;
begin  ddist:=rr*phi-rr*(sin(phi)-0);   end;

begin
 { assign (input,'input.txt');reset(input);
      assign (output,'output.txt'); rewrite(output);
  }

 read(n,rr,v);
 for i:=1 to n do read(a[i],b[i]);

 { for i:=0 to 1000 do writeln(i/100:0:3,' ',dist(i/100):0:5);
  }
     for i:=1 to n do
        begin
           aaa:=0; bbb:=1e+10;
           while abs(aaa-bbb)>1e-8 do
             begin
                ccc:=(aaa+bbb)/2;
                if dist(ccc)>(b[i]-a[i])/2 then bbb:=ccc else aaa:=ccc;

             end;
        { writeln(2*ccc/v:0:8,' ',dist(ccc):0:7);
         }
         ccc1:=ccc;
           aaa:=0; bbb:=1e+10;
           while abs(aaa-bbb)>1e-8 do
             begin
                ccc:=(aaa+bbb)/2;
                if ddist(ccc)>(b[i]-a[i])/2 then bbb:=ccc else aaa:=ccc;

             end;
        { writeln(2*ccc/v:0:8,' ',dist(ccc):0:7);
         }
           if ccc1<ccc then writeln(ccc1:0:8) else writeln(ccc:0:8);

        end;

   1:          close(output);
end.

   {$APPTYPE CONSOLE}
const nn=1000001; besk=200000000000000;
   nnn=2000000;  eps=1e-6; modul=1000000007;
 label 1,2,3,4;
var ii,jj,kt,ppp,god,day,mon,p,mask,i0,j0,k,i,j,start,finish,kol,m:longint;
step,pos,p1,p2,ll,bb,pp,tt,ot1,ot2,s,kold,gr,n,kolshok:int64;
ot,dist1,avt,zap,q,ba,by,aa,ay,t,kk,centr,koef:int64;
flag2,flag1,flag:boolean;
ch1,ch2,ch:char;
ccc1,v,rr,h1,h2,t1,t2,h,r1,r2,aaa,bbb,ccc,hh,po,pt,doltek,dolpred:extended;
dd,y,fact,x,c,b,a,prost:array[0..1000000] of extended;
oldmarked,marked,zan: array[0..330006] of boolean;
per: array[0..4000,0..4000] of int64;
ott :double;
ss1,ss2:string;
ss:array[0..10000] of string;
pole:array[-10..110,-10..100] of char;
name:array[0..2000] of string;
function min (a,b:int64):int64;begin min:=b;if a<b then min:=a;  end;
function max (a,b:int64):int64;begin max:=b;if a>b then max:=a;  end;

 function nod(x,y:int64):int64; var z:int64;
begin   repeat  z:=x mod y;x:=y;y:=z;   until  z=0 ;  nod:=x;end;

function  koldel(p,mmod:int64):int64; var pp,ot:int64;
begin  koldel:=(p+mmod) div mmod; end;

function dist(phi:extended):extended;
begin  dist:=rr*phi+rr*(sin(phi)-0);   end;

function ddist(phi:extended):extended;
begin  ddist:=rr*phi-rr*(sin(phi)-0);   end;

begin
 { assign (input,'input.txt');reset(input);
      assign (output,'output.txt'); rewrite(output);
  }

 read(n,rr,v);
 for i:=1 to n do read(a[i],b[i]);

 { for i:=0 to 1000 do writeln(i/100:0:3,' ',dist(i/100):0:5);
  }
     for i:=1 to n do
        begin
           aaa:=0; bbb:=1e+10;
          { a[i]:=a[i]/rr; b[i]:=b[i]/rr;
          }
           while abs(aaa-bbb)>1e-8 do
             begin
                ccc:=(aaa+bbb)/2;
                if dist(ccc)>(b[i]-a[i])/2 then bbb:=ccc else aaa:=ccc;

             end;
        { writeln(2*ccc/v:0:8,' ',dist(ccc):0:7);
         }
         ccc1:=ccc;
           aaa:=0; bbb:=1e+10;
           while abs(aaa-bbb)>1e-8 do
             begin
                ccc:=(aaa+bbb)/2;
                if ddist(ccc)>(b[i]-a[i])/2 then bbb:=ccc else aaa:=ccc;

             end;
        { writeln(2*ccc/v:0:8,' ',dist(ccc):0:7);
         }
            ccc1:=rr*2*ccc1/v; ccc:=rr*2*ccc/v;
           if ccc1<ccc then writeln(ccc1:0:8) else writeln(ccc:0:8);

        end;

   1:          close(output);
end.

   {$APPTYPE CONSOLE}
const nn=1000001; besk=200000000000000;
   nnn=2000000;  eps=1e-6; modul=1000000007;
 label 1,2,3,4;
var ii,jj,kt,ppp,god,day,mon,p,mask,i0,j0,k,i,j,start,finish,kol,m:longint;
step,pos,p1,p2,ll,bb,pp,tt,ot1,ot2,s,kold,gr,n,kolshok:int64;
ot,dist1,avt,zap,q,ba,by,aa,ay,t,kk,centr,koef:int64;
flag2,flag1,flag:boolean;
ch1,ch2,ch:char;
ccc1,v,rr,h1,h2,t1,t2,h,r1,r2,aaa,bbb,ccc,hh,po,pt,doltek,dolpred:extended;
dd,y,fact,x,c,b,a,prost:array[0..1000000] of extended;
oldmarked,marked,zan: array[0..330006] of boolean;
per: array[0..4000,0..4000] of int64;
ott :double;
ss1,ss2:string;
ss:array[0..10000] of string;
pole:array[-10..110,-10..100] of char;
name:array[0..2000] of string;
function min (a,b:int64):int64;begin min:=b;if a<b then min:=a;  end;
function max (a,b:int64):int64;begin max:=b;if a>b then max:=a;  end;

 function nod(x,y:int64):int64; var z:int64;
begin   repeat  z:=x mod y;x:=y;y:=z;   until  z=0 ;  nod:=x;end;

function  koldel(p,mmod:int64):int64; var pp,ot:int64;
begin  koldel:=(p+mmod) div mmod; end;

function dist(phi:extended):extended;
begin phi:=phi*rr/v; dist:=rr*phi+rr*(sin(phi)-0);   end;

function ddist(phi:extended):extended;
begin  phi:=phi*rr/v; ddist:=rr*phi-rr*(sin(phi)-0);   end;

begin
 { assign (input,'input.txt');reset(input);
      assign (output,'output.txt'); rewrite(output);
  }

 read(n,rr,v);
 for i:=1 to n do read(a[i],b[i]);

 { for i:=0 to 1000 do writeln(i/100:0:3,' ',dist(i/100):0:5);
  }
     for i:=1 to n do
        begin
           aaa:=0; bbb:=1e+10;
          { a[i]:=a[i]/rr; b[i]:=b[i]/rr;
          }
           while abs(aaa-bbb)>1e-17 do
             begin
                ccc:=(aaa+bbb)/2;
                if dist(ccc)>(b[i]-a[i])/2 then bbb:=ccc else aaa:=ccc;
              {  writeln(ccc:0:9,' ',dist(ccc):0:9);
               }
             end;
        { writeln(2*ccc/v:0:8,' ',dist(ccc):0:7);
         }
         ccc1:=ccc;
           aaa:=0; bbb:=1e+10;
           while abs(aaa-bbb)>1e-17 do
             begin
                ccc:=(aaa+bbb)/2;
                if ddist(ccc)>(b[i]-a[i])/2 then bbb:=ccc else aaa:=ccc;
              {  writeln(ccc:0:9,' ',ddist(ccc):0:9);
            } end;
        { writeln(2*ccc/v:0:8,' ',dist(ccc):0:7);
         }
           { ccc1:=rr*2*ccc1/v; ccc:=rr*2*ccc/v;
            writeln(ccc:0:10,' ==  ',ccc1:0:10);
           }
           if ccc1<ccc then writeln(ccc1/2:0:8) else writeln(ccc/2:0:8);

        end;

   1:          close(output);
end.

{$A8,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O-,P+,Q-,R+,S+,T-,U-,V+,W-,X+,Y+,Z1}
{$MINSTACKSIZE $00004000}
{$MAXSTACKSIZE $00100000}
{$IMAGEBASE $00400000}
{$APPTYPE CONSOLE}

const filename='b';
      oo=maxlongint div 2;
      eps=1e-6;
      eee=1e-21;

var qq,cc,a,aa:array[0..1000000]of longint;
    qc,he:array[0..2014,0..2014]of longint;
    s,ss,sss,s0,s1,s2,s3:string;
    x,y,z,xx,yy,zz,x0,y0,z0,x1,x2,x3,y1,y2,y3,z1,z2,z3,rr:extended;
    nt,ii,jj,n,m,q,c,q0,c0,q1,c1,q2,c2,q3,c3:longint;
    nn,mm,kk,u,v,res,cur,max,min:longint;
    test,ll,t,tt:longint;
    b,bb,bbb,b0,b1,b2,b3:boolean;

function mx(q,c:longint):longint;
  begin
  if q>c then mx:=q else mx:=c;
  end;

function mn(q,c:longint):longint;
  begin
  if q<c then mn:=q else mn:=c;
  end;

procedure init;
  begin
  assign(input,filename+'.in');
  assign(output,filename+'.out');
  reset(input);
  rewrite(output);
  end;

procedure fin;
  begin
  close(input);
  close(output);
  end;

procedure clear;
var i,j,k:longint;
  begin
  fillchar(qc,sizeof(qc),0);
  end;

procedure load;
var i,j,k:longint;
  begin
  end;

procedure save;
var i,j,k:longint;
  begin
  end;

procedure run;
var i,j,k:longint;
  begin
  //init;
  read(n,u,v);
  for i:=1 to n do
    begin
    read(x1,x2);
    xx:=(x2-x1)/u;
    rr:=trunc(xx/(2*pi));
    xx:=(xx-2*pi*rr)/2;
    y1:=0;
    y2:=pi;
    for j:=1 to 45 do
      begin
      y3:=0.5*(y1+y2);
      if y3+sin(y3)<xx then y1:=y3 else y2:=y3;
      end;
    rr:=rr+2*y1/(2*pi);
    writeln(2*pi*rr*u/v:0:12);
    end;

  //fin;
  end;

begin
nt:=1;
//readln(nt);
for test:=1 to nt do
  begin
  clear;
  load;
  run;
  save;
  end;
end.

{$A8,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O+,P+,Q-,R-,S-,T-,U-,V+,W-,X+,Y+,Z1}
{$MINSTACKSIZE $00004000}
{$MAXSTACKSIZE $00100000}
{$IMAGEBASE $00400000}
{$APPTYPE CONSOLE}

const filename='b';
      oo=maxlongint div 2;
      eps=1e-6;
      eee=1e-21;

var x,y,z,xx,yy,zz,x0,y0,z0,x1,x2,x3,z1,z2,z3,rr:extended;
    p2,y1,y2,y3:extended;
    nt,ii,jj,n,m,q,c,q0,c0,q1,c1,q2,c2,q3,c3:longint;
    nn,mm,kk,u,v,res,cur,max,min:longint;
    test,ll,t,tt:longint;
    b,bb,bbb,b0,b1,b2,b3:boolean;

function mx(q,c:longint):longint;
  begin
  if q>c then mx:=q else mx:=c;
  end;

function mn(q,c:longint):longint;
  begin
  if q<c then mn:=q else mn:=c;
  end;

procedure init;
  begin
  assign(input,filename+'.in');
  assign(output,filename+'.out');
  reset(input);
  rewrite(output);
  end;

procedure fin;
  begin
  close(input);
  close(output);
  end;

procedure clear;
var i,j,k:longint;
  begin
  end;

procedure load;
var i,j,k:longint;
  begin
  end;

procedure save;
var i,j,k:longint;
  begin
  end;

function sinus(x:extended):extended;
var ss,nu,de:extended;
    i:longint;
    begin
    ss:=x;
    de:=1.0;
    nu:=x;
    for i:=1 to 6 do
      begin
      nu:=nu*x*x;
      de:=de*(2*i+1)*(2*i);
      if odd(i) then ss:=ss-nu/de else ss:=ss+nu/de;
      end;
    sinus:=ss;
    end;

procedure run;
var i,j,k:longint;
  begin
  //init;
  read(n,u,v);
  p2:=2*pi;
  for i:=1 to n do
    begin
    read(x1,x2);
    xx:=(x2-x1)/u;
    rr:=trunc(xx/p2);
    xx:=0.5*(xx-p2*rr);
    y1:=0;
    y2:=pi;
    for j:=1 to 55 do
      begin
      y3:=0.5*(y1+y2);
      if sinus(y3)<xx-y3 then y1:=y3 else y2:=y3;
      end;
    rr:=rr+2*y1/p2;
    writeln(p2*rr*u/v:0:12);
    end;

  //fin;
  end;

begin
nt:=1;
//readln(nt);
for test:=1 to nt do
  begin
  clear;
  load;
  run;
  save;
  end;
end.

{$A8,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O+,P+,Q-,R-,S-,T-,U-,V+,W-,X+,Y+,Z1}
{$MINSTACKSIZE $00004000}
{$MAXSTACKSIZE $00100000}
{$IMAGEBASE $00400000}
{$APPTYPE CONSOLE}

const filename='b';
      oo=maxlongint div 2;
      eps=1e-6;
      eee=1e-21;

var x,y,z,xx,yy,zz,x0,y0,z0,x1,x2,x3,z1,z2,z3,rr:extended;
    p2,y1,y2,y3:extended;
    nt,ii,jj,n,m,q,c,q0,c0,q1,c1,q2,c2,q3,c3:longint;
    nn,mm,kk,u,v,res,cur,max,min:longint;
    test,ll,t,tt:longint;
    b,bb,bbb,b0,b1,b2,b3:boolean;

function mx(q,c:longint):longint;
  begin
  if q>c then mx:=q else mx:=c;
  end;

function mn(q,c:longint):longint;
  begin
  if q<c then mn:=q else mn:=c;
  end;

procedure init;
  begin
  assign(input,filename+'.in');
  assign(output,filename+'.out');
  reset(input);
  rewrite(output);
  end;

procedure fin;
  begin
  close(input);
  close(output);
  end;

procedure clear;
var i,j,k:longint;
  begin
  end;

procedure load;
var i,j,k:longint;
  begin
  end;

procedure save;
var i,j,k:longint;
  begin
  end;

function sinus(x:extended):extended;
var ss,nu,de:extended;
    i:longint;
    begin
    ss:=x;
    de:=1.0;
    nu:=x;
    for i:=1 to 5 do
      begin
      nu:=nu*x*x;
      de:=de*(2*i+1)*(2*i);
      if odd(i) then ss:=ss-nu/de else ss:=ss+nu/de;
      end;
    sinus:=ss;
    end;

procedure run;
var i,j,k:longint;
  begin
  //init;
  read(n,u,v);
  p2:=2*pi;
  for i:=1 to n do
    begin
    read(x1,x2);
    xx:=(x2-x1)/u;
    rr:=trunc(xx/p2);
    xx:=0.5*(xx-p2*rr);
    y1:=0;
    y2:=pi;
    for j:=1 to 55 do
      begin
      y3:=0.5*(y1+y2);
      if sinus(y3)<xx-y3 then y1:=y3 else y2:=y3;
      end;
    rr:=rr+2*y1/p2;
    writeln(p2*rr*u/v:0:12);
    end;

  //fin;
  end;

begin
nt:=1;
//readln(nt);
for test:=1 to nt do
  begin
  clear;
  load;
  run;
  save;
  end;
end.

{$A8,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O+,P+,Q-,R-,S-,T-,U-,V+,W-,X+,Y+,Z1}
{$MINSTACKSIZE $00004000}
{$MAXSTACKSIZE $00100000}
{$IMAGEBASE $00400000}
{$APPTYPE CONSOLE}

const filename='b';
      oo=maxlongint div 2;
      eps=1e-6;
      eee=1e-21;

var x,y,z,xx,yy,zz,x0,y0,z0,x1,x2,x3,z1,z2,z3,rr:real;
    p2,y1,y2,y3:real;
    nt,ii,jj,n,m,q,c,q0,c0,q1,c1,q2,c2,q3,c3:longint;
    nn,mm,kk,u,v,res,cur,max,min:longint;
    test,ll,t,tt:longint;
    b,bb,bbb,b0,b1,b2,b3:boolean;

function mx(q,c:longint):longint;
  begin
  if q>c then mx:=q else mx:=c;
  end;

function mn(q,c:longint):longint;
  begin
  if q<c then mn:=q else mn:=c;
  end;

procedure init;
  begin
  assign(input,filename+'.in');
  assign(output,filename+'.out');
  reset(input);
  rewrite(output);
  end;

procedure fin;
  begin
  close(input);
  close(output);
  end;

procedure clear;
var i,j,k:longint;
  begin
  end;

procedure load;
var i,j,k:longint;
  begin
  end;

procedure save;
var i,j,k:longint;
  begin
  end;

procedure run;
var i,j,k:longint;
  begin
  //init;
  read(n,u,v);
  p2:=2*pi;
  for i:=1 to n do
    begin
    read(x1,x2);
    xx:=(x2-x1)/u;
    rr:=trunc(xx/p2);
    xx:=0.5*(xx-p2*rr)/2;
    y1:=0;
    y2:=pi;
    for j:=1 to 55 do
      begin
      y3:=0.5*(y1+y2);
      if y3+sin(y3)<xx then y1:=y3 else y2:=y3;
      end;
    rr:=rr+2*y1/p2;
    writeln(p2*rr*u/v:0:12);
    end;

  //fin;
  end;

begin
nt:=1;
//readln(nt);
for test:=1 to nt do
  begin
  clear;
  load;
  run;
  save;
  end;
end.

{$A8,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O-,P+,Q-,R+,S+,T-,U-,V+,W-,X+,Y+,Z1}
{$MINSTACKSIZE $00004000}
{$MAXSTACKSIZE $00100000}
{$IMAGEBASE $00400000}
{$APPTYPE CONSOLE}

const filename='b';
      oo=maxlongint div 2;
      eps=1e-6;
      eee=1e-21;

var qq,cc,a,aa:array[0..1000000]of longint;
    qc,he:array[0..2014,0..2014]of longint;
    s,ss,sss,s0,s1,s2,s3:string;
    x,y,z,xx,yy,zz,x0,y0,z0,x1,x2,x3,y1,y2,y3,z1,z2,z3,rr:extended;
    nt,ii,jj,n,m,q,c,q0,c0,q1,c1,q2,c2,q3,c3:longint;
    nn,mm,kk,u,v,res,cur,max,min:longint;
    test,ll,t,tt:longint;
    b,bb,bbb,b0,b1,b2,b3:boolean;

function mx(q,c:longint):longint;
  begin
  if q>c then mx:=q else mx:=c;
  end;

function mn(q,c:longint):longint;
  begin
  if q<c then mn:=q else mn:=c;
  end;

procedure init;
  begin
  assign(input,filename+'.in');
  assign(output,filename+'.out');
  reset(input);
  rewrite(output);
  end;

procedure fin;
  begin
  close(input);
  close(output);
  end;

procedure clear;
var i,j,k:longint;
  begin
  fillchar(qc,sizeof(qc),0);
  end;

procedure load;
var i,j,k:longint;
  begin
  end;

procedure save;
var i,j,k:longint;
  begin
  end;

procedure run;
var i,j,k:longint;
  begin
  //init;
  read(n,u,v);
  for i:=1 to n do
    begin
    read(x1,x2);
    xx:=(x2-x1)/u;
    rr:=trunc(xx/(2*pi));
    xx:=(xx-2*pi*rr)/2;
    y1:=0;
    y2:=pi;
    for j:=1 to 40 do
      begin
      y3:=0.5*(y1+y2);
      if y3+sin(y3)<xx then y1:=y3 else y2:=y3;
      end;
    rr:=rr+2*y1/(2*pi);
    writeln(2*pi*rr*u/v:0:12);
    end;

  //fin;
  end;

begin
nt:=1;
//readln(nt);
for test:=1 to nt do
  begin
  clear;
  load;
  run;
  save;
  end;
end.

{$A8,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O+,P+,Q-,R-,S-,T-,U-,V+,W-,X+,Y+,Z1}
{$MINSTACKSIZE $00004000}
{$MAXSTACKSIZE $00100000}
{$IMAGEBASE $00400000}
{$APPTYPE CONSOLE}

const filename='b';
      oo=maxlongint div 2;
      eps=1e-6;
      eee=1e-21;

var x,y,z,xx,yy,zz,x0,y0,z0,x1,x2,x3,z1,z2,z3,rr:extended;
    p2,y1,y2,y3:extended;
    nt,ii,jj,n,m,q,c,q0,c0,q1,c1,q2,c2,q3,c3:longint;
    nn,mm,kk,u,v,res,cur,max,min:longint;
    test,ll,t,tt:longint;
    b,bb,bbb,b0,b1,b2,b3:boolean;

function mx(q,c:longint):longint;
  begin
  if q>c then mx:=q else mx:=c;
  end;

function mn(q,c:longint):longint;
  begin
  if q<c then mn:=q else mn:=c;
  end;

procedure init;
  begin
  assign(input,filename+'.in');
  assign(output,filename+'.out');
  reset(input);
  rewrite(output);
  end;

procedure fin;
  begin
  close(input);
  close(output);
  end;

procedure clear;
var i,j,k:longint;
  begin
  end;

procedure load;
var i,j,k:longint;
  begin
  end;

procedure save;
var i,j,k:longint;
  begin
  end;

function sinus(x:extended):extended;
var ss,nu,de:extended;
    i:longint;
    begin
    ss:=x;
    de:=1.0;
    nu:=x;
    for i:=1 to 7 do
      begin
      nu:=nu*x*x;
      de:=de*(2*i+1)*(2*i);
      if odd(i) then ss:=ss-nu/de else ss:=ss+nu/de;
      end;
    sinus:=ss;
    end;

procedure run;
var i,j,k:longint;
  begin
  //init;
  read(n,u,v);
  p2:=2*pi;
  for i:=1 to n do
    begin
    read(x1,x2);
    xx:=(x2-x1)/u;
    rr:=trunc(xx/p2);
    xx:=0.5*(xx-p2*rr);
    y1:=0;
    y2:=pi;
    for j:=1 to 55 do
      begin
      y3:=0.5*(y1+y2);
      if sinus(y3)<xx-y3 then y1:=y3 else y2:=y3;
      end;
    rr:=rr+2*y1/p2;
    writeln(p2*rr*u/v:0:12);
    end;

  //fin;
  end;

begin
nt:=1;
//readln(nt);
for test:=1 to nt do
  begin
  clear;
  load;
  run;
  save;
  end;
end.

{$A8,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O-,P+,Q-,R+,S+,T-,U-,V+,W-,X+,Y+,Z1}
{$MINSTACKSIZE $00004000}
{$MAXSTACKSIZE $00100000}
{$IMAGEBASE $00400000}
{$APPTYPE CONSOLE}

const filename='b';
      oo=maxlongint div 2;
      eps=1e-6;
      eee=1e-21;

var qq,cc,a,aa:array[0..1000000]of longint;
    qc,he:array[0..2014,0..2014]of longint;
    s,ss,sss,s0,s1,s2,s3:string;
    x,y,z,xx,yy,zz,x0,y0,z0,x1,x2,x3,y1,y2,y3,z1,z2,z3,rr:extended;
    nt,ii,jj,n,m,q,c,q0,c0,q1,c1,q2,c2,q3,c3:longint;
    nn,mm,kk,u,v,res,cur,max,min:longint;
    test,ll,t,tt:longint;
    b,bb,bbb,b0,b1,b2,b3:boolean;

function mx(q,c:longint):longint;
  begin
  if q>c then mx:=q else mx:=c;
  end;

function mn(q,c:longint):longint;
  begin
  if q<c then mn:=q else mn:=c;
  end;

procedure init;
  begin
  assign(input,filename+'.in');
  assign(output,filename+'.out');
  reset(input);
  rewrite(output);
  end;

procedure fin;
  begin
  close(input);
  close(output);
  end;

procedure clear;
var i,j,k:longint;
  begin
  fillchar(qc,sizeof(qc),0);
  end;

procedure load;
var i,j,k:longint;
  begin
  end;

procedure save;
var i,j,k:longint;
  begin
  end;

procedure run;
var i,j,k:longint;
  begin
  //init;
  read(n,u,v);
  for i:=1 to n do
    begin
    read(x1,x2);
    xx:=(x2-x1)/u;
    rr:=trunc(xx/(2*pi));
    xx:=(xx-2*pi*rr)/2;
    y1:=0;
    y2:=pi;
    for j:=1 to 50 do
      begin
      y3:=0.5*(y1+y2);
      if y3+sin(y3)<xx then y1:=y3 else y2:=y3;
      end;
    rr:=rr+2*y1/(2*pi);
    writeln(2*pi*rr*u/v:0:12);
    end;

  //fin;
  end;

begin
nt:=1;
//readln(nt);
for test:=1 to nt do
  begin
  clear;
  load;
  run;
  save;
  end;
end.

{$A8,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O+,P+,Q-,R-,S-,T-,U-,V+,W-,X+,Y+,Z1}
{$MINSTACKSIZE $00004000}
{$MAXSTACKSIZE $00100000}
{$IMAGEBASE $00400000}
{$APPTYPE CONSOLE}

const filename='b';
      oo=maxlongint div 2;
      eps=1e-6;
      eee=1e-21;

var x,y,z,xx,yy,zz,x0,y0,z0,x1,x2,x3,z1,z2,z3,rr:extended;
    p2,y1,y2,y3:extended;
    nt,ii,jj,n,m,q,c,q0,c0,q1,c1,q2,c2,q3,c3:longint;
    nn,mm,kk,u,v,res,cur,max,min:longint;
    test,ll,t,tt:longint;
    b,bb,bbb,b0,b1,b2,b3:boolean;

function mx(q,c:longint):longint;
  begin
  if q>c then mx:=q else mx:=c;
  end;

function mn(q,c:longint):longint;
  begin
  if q<c then mn:=q else mn:=c;
  end;

procedure init;
  begin
  assign(input,filename+'.in');
  assign(output,filename+'.out');
  reset(input);
  rewrite(output);
  end;

procedure fin;
  begin
  close(input);
  close(output);
  end;

procedure clear;
var i,j,k:longint;
  begin
  end;

procedure load;
var i,j,k:longint;
  begin
  end;

procedure save;
var i,j,k:longint;
  begin
  end;

function sinus(x:extended):extended;
var ss,nu,de:extended;
    i:longint;
    begin
    ss:=x;
    de:=1.0;
    nu:=x;
    for i:=1 to 3 do
      begin
      nu:=nu*x*x;
      de:=de*(2*i+1)*(2*i);
      if odd(i) then ss:=ss-nu/de else ss:=ss+nu/de;
      end;
    sinus:=ss;
    end;

procedure run;
var i,j,k:longint;
  begin
  //init;
  read(n,u,v);
  p2:=2*pi;
  for i:=1 to n do
    begin
    read(x1,x2);
    xx:=(x2-x1)/u;
    rr:=trunc(xx/p2);
    xx:=0.5*(xx-p2*rr);
    y1:=0;
    y2:=pi;
    for j:=1 to 55 do
      begin
      y3:=0.5*(y1+y2);
      if sinus(y3)<xx-y3 then y1:=y3 else y2:=y3;
      end;
    rr:=rr+2*y1/p2;
    writeln(p2*rr*u/v:0:12);
    end;

  //fin;
  end;

begin
nt:=1;
//readln(nt);
for test:=1 to nt do
  begin
  clear;
  load;
  run;
  save;
  end;
end.

{$A8,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O-,P+,Q-,R+,S+,T-,U-,V+,W-,X+,Y+,Z1}
{$MINSTACKSIZE $00004000}
{$MAXSTACKSIZE $00100000}
{$IMAGEBASE $00400000}
{$APPTYPE CONSOLE}

const filename='b';
      oo=maxlongint div 2;
      eps=1e-6;
      eee=1e-21;

var qq,cc,a,aa:array[0..1000000]of longint;
    qc,he:array[0..2014,0..2014]of longint;
    s,ss,sss,s0,s1,s2,s3:string;
    x,y,z,xx,yy,zz,x0,y0,z0,x1,x2,x3,y1,y2,y3,z1,z2,z3,rr:extended;
    nt,ii,jj,n,m,q,c,q0,c0,q1,c1,q2,c2,q3,c3:longint;
    nn,mm,kk,u,v,res,cur,max,min:longint;
    test,ll,t,tt:longint;
    b,bb,bbb,b0,b1,b2,b3:boolean;

function mx(q,c:longint):longint;
  begin
  if q>c then mx:=q else mx:=c;
  end;

function mn(q,c:longint):longint;
  begin
  if q<c then mn:=q else mn:=c;
  end;

procedure init;
  begin
  assign(input,filename+'.in');
  assign(output,filename+'.out');
  reset(input);
  rewrite(output);
  end;

procedure fin;
  begin
  close(input);
  close(output);
  end;

procedure clear;
var i,j,k:longint;
  begin
  fillchar(qc,sizeof(qc),0);
  end;

procedure load;
var i,j,k:longint;
  begin
  end;

procedure save;
var i,j,k:longint;
  begin
  end;

procedure run;
var i,j,k:longint;
  begin
  //init;
  read(n,u,v);
  for i:=1 to n do
    begin
    read(x1,x2);
    xx:=(x2-x1)/u;
    rr:=trunc(xx/(2*pi));
    xx:=(xx-2*pi*rr)/2;
    y1:=0;
    y2:=pi;
    for j:=1 to 30 do
      begin
      y3:=0.5*(y1+y2);
      if y3+sin(y3)<xx then y1:=y3 else y2:=y3;
      end;
    rr:=rr+2*y1/(2*pi);
    writeln(2*pi*rr*u/v:0:12);
    end;

  //fin;
  end;

begin
nt:=1;
//readln(nt);
for test:=1 to nt do
  begin
  clear;
  load;
  run;
  save;
  end;
end.

{$A8,B-,C+,D+,E-,F-,G+,H+,I+,J-,K-,L+,M-,N+,O-,P+,Q-,R+,S+,T-,U-,V+,W-,X+,Y+,Z1}
{$MINSTACKSIZE $00004000}
{$MAXSTACKSIZE $00100000}
{$IMAGEBASE $00400000}
{$APPTYPE CONSOLE}

const filename='b';
      oo=maxlongint div 2;
      eps=1e-6;
      eee=1e-21;

var qq,cc,a,aa:array[0..1000000]of longint;
    qc,he:array[0..2014,0..2014]of longint;
    s,ss,sss,s0,s1,s2,s3:string;
    x,y,z,xx,yy,zz,x0,y0,z0,x1,x2,x3,y1,y2,y3,z1,z2,z3,rr:extended;
    nt,ii,jj,n,m,q,c,q0,c0,q1,c1,q2,c2,q3,c3:longint;
    nn,mm,kk,u,v,res,cur,max,min:longint;
    test,ll,t,tt:longint;
    b,bb,bbb,b0,b1,b2,b3:boolean;

function mx(q,c:longint):longint;
  begin
  if q>c then mx:=q else mx:=c;
  end;

function mn(q,c:longint):longint;
  begin
  if q<c then mn:=q else mn:=c;
  end;

procedure init;
  begin
  assign(input,filename+'.in');
  assign(output,filename+'.out');
  reset(input);
  rewrite(output);
  end;

procedure fin;
  begin
  close(input);
  close(output);
  end;

procedure clear;
var i,j,k:longint;
  begin
  fillchar(qc,sizeof(qc),0);
  end;

procedure load;
var i,j,k:longint;
  begin
  end;

procedure save;
var i,j,k:longint;
  begin
  end;

procedure run;
var i,j,k:longint;
  begin
  //init;
  read(n,u,v);
  for i:=1 to n do
    begin
    read(x1,x2);
    xx:=(x2-x1)/u;
    rr:=trunc(xx/(2*pi));
    xx:=(xx-2*pi*rr)/2;
    y1:=0;
    y2:=pi;
    for j:=1 to 36 do
      begin
      y3:=0.5*(y1+y2);
      if y3+sin(y3)<xx then y1:=y3 else y2:=y3;
      end;
    rr:=rr+2*y1/(2*pi);
    writeln(2*pi*rr*u/v:0:12);
    end;

  //fin;
  end;

begin
nt:=1;
//readln(nt);
for test:=1 to nt do
  begin
  clear;
  load;
  run;
  save;
  end;
end.