package body Shared
  with Refined_State => (Hidden => Box)
is
   protected body Box is
      procedure Set (V : Natural) is
      begin
         Val := V;
      end Set;
      function Get return Natural is (Val);
   end Box;
   function Last_Seen return Natural is (Box.Get) with Refined_Global => Box;
   task body Writer is
   begin
      Ticks := 1;
      Box.Set (5);
   end Writer;
   task body Reader is
      V : Integer;
   begin
      V := Ticks;
      if V in 0 .. 1_000 then
         Box.Set (V);
      end if;
   end Reader;
end Shared;
