puts Rational ( 123125010100101102032105110116040115116114044102109116061034037115034041010098101103105110010115116114061115116114046100117112010115116114046103115117098033040039094039044039042042039041010115116114046103115117098033040047040097099111115104124097115105110104124097116097110104124097116097110050124097116097110124097115105110124097099111115124099111115104124115105110104124116097110104124115105110124099111115124116097110124115113114116124108111103049048124108111103050124103097109109097124108111103124101120112124101114102099124101114102124104121112111116041047105041123034077097116104046035123036049046100111119110099097115101125034125010115116114046103115117098033040047040101040036124091094114120093041124112105041047105041123034077097116104058058035123036049046117112099097115101125034125010101118097108040102109116037115116114041010114101115099117101032069120099101112116105111110061062101010112117116115032034105110118097108105100032105110112117116034010101120105116032049010101110100010101110100010119061105110116040065082071086046115104105102116041046116111095105010104061105110116040065082071086046115104105102116041046116111095105010098061105110116040065082071086046115104105102116041046116111095102010101061105110116040065082071086046115104105102116041046116111095102010102061105110116040065082071086046106111105110040039032039041044034045062120123037115125034041010119105110061065114114097121046110101119040104041123065114114097121046110101119040119041123039032039125125010100120061040101045098041047119046116111095102010098101103105110010121061065114114097121046110101119040119041123124120124102091098043040120043048046053041042100120093125010114101115099117101032069120099101112116105111110010112117116115032034105110118097108105100032105110112117116034010101120105116032049010101110100010114044113061121046109105110109097120010114061048032105102032114062048010113061048032105102032113060048010114045061048046048048049032105102032114061061113010121046109097112033032100111032124122124032010112121061040040122045114041042104047040113045114041046116111095102045048046053041046114111117110100010112121061048032105102032112121032060032048010112121061104045049032105102032112121062061104010112121010101110100010121048061040045114042104047040113045114041046116111095102045048046053041046114111117110100010121048061048032105102032121048060048010121048061104045049032105102032121048062061104010100121061040113045114041047104046116111095102010119046116105109101115032100111032124120124010121049044121050061091121048044121091120093093046109105110109097120010040121049046046121050041046101097099104123124122124119105110091122093091120093061063035125010119105110091121048093091120093061063045010101110100010112117116115032119105110046114101118101114115101046109097112040038058106111105110041046106111105110040034010034041010 ,123125010100101102032105110116040115116114044102109116061034037115034041010098101103105110010115116114061115116114046100117112010115116114046103115117098033040039094039044039042042039041010115116114046103115117098033040047040097099111115104124097115105110104124097116097110104124097116097110050124097116097110124097115105110124097099111115124099111115104124115105110104124116097110104124115105110124099111115124116097110124115113114116124108111103049048124108111103050124103097109109097124108111103124101120112124101114102099124101114102124104121112111116041047105041123034077097116104046035123036049046100111119110099097115101125034125010115116114046103115117098033040047040101040036124091094114120093041124112105041047105041123034077097116104058058035123036049046117112099097115101125034125010101118097108040102109116037115116114041010114101115099117101032069120099101112116105111110061062101010112117116115032034105110118097108105100032105110112117116034010101120105116032049010101110100010101110100010119061105110116040065082071086046115104105102116041046116111095105010104061105110116040065082071086046115104105102116041046116111095105010098061105110116040065082071086046115104105102116041046116111095102010101061105110116040065082071086046115104105102116041046116111095102010102061105110116040065082071086046106111105110040039032039041044034045062120123037115125034041010119105110061065114114097121046110101119040104041123065114114097121046110101119040119041123039032039125125010100120061040101045098041047119046116111095102010098101103105110010121061065114114097121046110101119040119041123124120124102091098043040120043048046053041042100120093125010114101115099117101032069120099101112116105111110010112117116115032034105110118097108105100032105110112117116034010101120105116032049010101110100010114044113061121046109105110109097120010114061048032105102032114062048010113061048032105102032113060048010114045061048046048048049032105102032114061061113010121046109097112033032100111032124122124032010112121061040040122045114041042104047040113045114041046116111095102045048046053041046114111117110100010112121061048032105102032112121032060032048010112121061104045049032105102032112121062061104010112121010101110100010121048061040045114042104047040113045114041046116111095102045048046053041046114111117110100010121048061048032105102032121048060048010121048061104045049032105102032121048062061104010100121061040113045114041047104046116111095102010119046116105109101115032100111032124120124010121049044121050061091121048044121091120093093046109105110109097120010040121049046046121050041046101097099104123124122124119105110091122093091120093061063035125010119105110091121048093091120093061063045010101110100010112117116115032119105110046114101118101114115101046109097112040038058106111105110041046106111105110040034010034041011 ) .numerator .to_s .chars .each_slice ( 3 ) .map { | x| x.join .to_i .chr } .join
cHV0cyBSYXRpb25hbCgxMjMxMjUwMTAxMDAxMDExMDIwMzIxMDUxMTAxMTYwNDAxMTUxMTYxMTQwNDQxMDIxMDkxMTYwNjEwMzQwMzcxMTUwM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MDkxMTIyMDkzMDkxMTIwMDkzMDYxMDYzMDM1MTI1MDEwMTE5MTA1MTEwMDkxMTIxMDQ4MDkzMDkxMTIwMDkzMDYxMDYzMDQ1MDEwMTAxMTEwMTAwMDEwMTEyMTE3MTE2MTE1MDMyMTE5MTA1MTEwMDQ2MTE0MTAxMTE4MTAxMTE0MTE1MTAxMDQ2MTA5MDk3MTEyMDQwMDM4MDU4MTA2MTExMTA1MTEwMDQxMDQ2MTA2MTExMTA1MTEwMDQwMDM0MDEwMDM0MDQxMDExKS5udW1lcmF0b3IudG9fcy5jaGFycy5lYWNoX3NsaWNlKDMpLm1hcHt8eHx4LmpvaW4udG9faS5jaHJ9LmpvaW4=
stdout
{}
def int(str,fmt="%s")
begin
str=str.dup
str.gsub!('^','**')
str.gsub!(/(acosh|asinh|atanh|atan2|atan|asin|acos|cosh|sinh|tanh|sin|cos|tan|sqrt|log10|log2|gamma|log|exp|erfc|erf|hypot)/i){"Math.#{$1.downcase}"}
str.gsub!(/(e($|[^rx])|pi)/i){"Math::#{$1.upcase}"}
eval(fmt%str)
rescue Exception=>e
puts "invalid input"
exit 1
end
end
w=int(ARGV.shift).to_i
h=int(ARGV.shift).to_i
b=int(ARGV.shift).to_f
e=int(ARGV.shift).to_f
f=int(ARGV.join(' '),"->x{%s}")
win=Array.new(h){Array.new(w){' '}}
dx=(e-b)/w.to_f
begin
y=Array.new(w){|x|f[b+(x+0.5)*dx]}
rescue Exception
puts "invalid input"
exit 1
end
r,q=y.minmax
r=0 if r>0
q=0 if q<0
r-=0.001 if r==q
y.map! do |z|
py=((z-r)*h/(q-r).to_f-0.5).round
py=0 if py < 0
py=h-1 if py>=h
py
end
y0=(-r*h/(q-r).to_f-0.5).round
y0=0 if y0<0
y0=h-1 if y0>=h
dy=(q-r)/h.to_f
w.times do |x|
y1,y2=[y0,y[x]].minmax
(y1..y2).each{|z|win[z][x]=?#}
win[y0][x]=?-
end
puts win.reverse.map(&:join).join("
")