I am new in programming. I need to convert a Fortran code to Rstudio. Could someone help me please. Any help would be greatly appreciated. My code is the following

```
use msimsl
use PORTLIB
integer n(1),k,l,x,y,s1,s2
integer,allocatable :: M1(:),M2(:)
Double precision p,p1,p2
write (*,*) 'Enter (x,y)'
read (*,*) x,y
open(unit=1,file='result.txt')
l=0
k=0
do 1 I=1,10000000
s1=0
s2=0
n=0
call RNPOI(1,16.0,n)
if(n(1).eq.0) then
k=k+1
goto 1
endif
allocate (M1(n(1)),M2(n(1)))
call RNBIN(n(1),2,0.25,M1)
call RNBIN(n(1),2,0.5,M2)
do 2 j=1,n(1)
s1=s1+M1(j)
2 s2=s2+M2(j)
if (s1.EQ.x.and.s2.LE.y) l=l+1
if (s1.LT.x.and.s2.eq.y) l=l+1
if (s1.LT.x.and.s2.LT.y) k=k+1
DEALLOCATE (M1,M2)
1 continue
p1=real(k)/10000000.0d0
p2=(real(k)+real(l))/10000000.0d0
p=(real(k)+0.5*real(l))/10000000.0d0
write (1,*) ' The true LESS p-value =',p1
write (1,*) ' The true Mid-p-value =',p
write (1,*) ' The true p-value =',p2
close(unit=1)
stop
end
```