! Warning! !
! Project Euler Probrem 17 Fortran YOS G-spec !
! http://odz.sakura.ne.jp/projecteuler/ !
program main
	integer i,sum
	sum=0
	do i=1,1000,1 !1から1000まで
		if(mod(i,100)==10)then
			sum=sum+3
			if(100<=i)then
				if(int(i/100)==1)then
					sum=sum+3
				elseif(int(i/100)==2)then
					sum=sum+3
				elseif(int(i/100)==3)then
					sum=sum+5
				elseif(int(i/100)==4)then
					sum=sum+4
				elseif(int(i/100)==5)then
					sum=sum+4
				elseif(int(i/100)==6)then
					sum=sum+3
				elseif(int(i/100)==7)then
					sum=sum+5
				elseif(int(i/100)==8)then
					sum=sum+5
				elseif(int(i/100)==9)then
					sum=sum+4
				endif
				sum=sum+7
				sum=sum+3
			endif
		elseif(mod(i,100)==0)then
			if(int(i/100)==1)then
				sum=sum+3
			elseif(int(i/100)==2)then
				sum=sum+3
			elseif(int(i/100)==3)then
				sum=sum+5
			elseif(int(i/100)==4)then
				sum=sum+4
			elseif(int(i/100)==5)then
				sum=sum+4
			elseif(int(i/100)==6)then
				sum=sum+3
			elseif(int(i/100)==7)then
				sum=sum+5
			elseif(int(i/100)==8)then
				sum=sum+5
			elseif(int(i/100)==9)then
				sum=sum+4
			endif
			sum=sum+7
		elseif(i==1000)then
			sum=sum+11
		elseif(mod(i,100)<10.or.20<=mod(i,100))then
			if(mod(i,10)==1)then
				sum=sum+3
			elseif(mod(i,10)==2)then
				sum=sum+3
			elseif(mod(i,10)==3)then
				sum=sum+5
			elseif(mod(i,10)==4)then
				sum=sum+4
			elseif(mod(i,10)==5)then
				sum=sum+4
			elseif(mod(i,10)==6)then
				sum=sum+3
			elseif(mod(i,10)==7)then
				sum=sum+5
			elseif(mod(i,10)==8)then
				sum=sum+5
			elseif(mod(i,10)==9)then
				sum=sum+4
			endif
			
			if(int(mod(i,100)/10)==2)then
				sum=sum+6
			elseif(int(mod(i,100)/10)==3)then
				sum=sum+6
			elseif(int(mod(i,100)/10)==4)then
				sum=sum+5
			elseif(int(mod(i,100)/10)==5)then
				sum=sum+5
			elseif(int(mod(i,100)/10)==6)then
				sum=sum+5
			elseif(int(mod(i,100)/10)==7)then
				sum=sum+7
			elseif(int(mod(i,100)/10)==8)then
				sum=sum+6
			elseif(int(mod(i,100)/10)==9)then
				sum=sum+6
			endif
			if(100<=i)then
					if(int(i/100)==1)then
					sum=sum+3
				elseif(int(i/100)==2)then
					sum=sum+3
				elseif(int(i/100)==3)then
					sum=sum+5
				elseif(int(i/100)==4)then
					sum=sum+4
				elseif(int(i/100)==5)then
					sum=sum+4
				elseif(int(i/100)==6)then
					sum=sum+3
				elseif(int(i/100)==7)then
					sum=sum+5
				elseif(int(i/100)==8)then
					sum=sum+5
				elseif(int(i/100)==9)then
					sum=sum+4
				endif
				sum=sum+7
				sum=sum+3
			endif
		else
			if(mod(i,10)==1)then
				sum=sum+6
			elseif(mod(i,10)==2)then
				sum=sum+6
			elseif(mod(i,10)==3)then
				sum=sum+8
			elseif(mod(i,10)==4)then
				sum=sum+8
			elseif(mod(i,10)==5)then
				sum=sum+7
			elseif(mod(i,10)==6)then
				sum=sum+7
			elseif(mod(i,10)==7)then
				sum=sum+9
			elseif(mod(i,10)==8)then
				sum=sum+8
			elseif(mod(i,10)==9)then
				sum=sum+8
			endif
			if(100<=i)then
				if(int(i/100)==1)then
					sum=sum+3
				elseif(int(i/100)==2)then
					sum=sum+3
				elseif(int(i/100)==3)then
					sum=sum+5
				elseif(int(i/100)==4)then
					sum=sum+4
				elseif(int(i/100)==5)then
					sum=sum+4
				elseif(int(i/100)==6)then
					sum=sum+3
				elseif(int(i/100)==7)then
					sum=sum+5
				elseif(int(i/100)==8)then
					sum=sum+5
				elseif(int(i/100)==9)then
					sum=sum+4
				endif
				sum=sum+7
				sum=sum+3
			endif
		endif
	enddo
	write(*,"(i0)")sum
	read *
endprogram main