#!/usr/bin/python

#   This is a sample python program that writes a VAL program.

#   It reads three values from the file "input.txt"

#   1. a radius
#   2. an angle
#   3. an integer

#   and outputs a VAL program that will move the robot in a circular
#   arc that encompasses the angle inputted.  The circle is actually
#   approximated by straight line segments, and the last input, the
#   integer, is how many line segments should be used to approximate
#   the circle.

#   For python documentation, see http://www.python.org

import math

fin = open('input.txt','r')
fout = open('program.txt','w')

r,theta,count = float(fin.readline()), float(fin.readline())*3.1415926/180.0, int(fin.readline())

x,y,z,o,a,t = 100.0,250.0,-175.0,179.0,1.0,89.0

ang = 0.0
for i in range(count):
    ang =  i*theta/float(count)
    x = x - r*theta/count*math.cos(ang)
    y = y + r*theta/count*math.sin(ang)
    fout.write('DP P'+`i`+' '+`x`+' '+`y`+' '+`z`+' '+`o`+' '+`a`+' ' +`t`+'\n')

fout.write('DP P100 100 250 -175 179 1 89\n')
fout.write('SPEED 10 ALWAYS\n')
fout.write('MOVE P100\n');

for i in range(count):
    ang =  i*theta/float(count)
    fout.write('DRAW '+`-r*theta/float(count)*math.cos(ang)`+', '+`r*theta/count*math.sin(ang)`+'\n')

fout.write('DP P100 100 250 -175 179 1 89\n')
fout.write('SPEED 10 ALWAYS\n')
fout.write('MOVE P100\n');

for i in range(count):
    fout.write('MOVE P'+`i`+'\n');

fout.write('READY\n');
fin.close()
fout.close()

