Help, Please

Help, please.  Someone who is good at math and figuring out these things, please help.  Because if I think about this any longer, I might hurt myself from banging my head on the wall.

See, I'm trying to figure out how many pieces of picture rail to buy.  I am told that picture rail comes in lengths of 16 feet and 7 feet.  (That 7' length seems odd to me...why not 8 ft??)  At first, I had a what-the-hell attitude towards it:  the room's about 15 by 15, that's 60 feet of picture rail, done.  Then it occurred to me that subtracting the width of the doors and the window might save me some cash.  Um, yeah, because without those I figure I need about 45 feet of rail.  I think.  Or I could be wrong.

Then I got to thinking about how many cuts I would have to make and how many pieces I could get out of each length of rail.  (And by "I", of course I really mean Charlie.)  That's when my head started to hurt.

Hey, let's put it in the form of a word problem.  Some people--not me--are good at those.  That'll make it easier to understand. 


If Jayne is buying picture rail for her front parlor, and the dimensions of the room are as shown in the photo, and picture rail comes in lengths of 7' and 16', how many pieces of picture rail of each length will Jayne need to buy in order to have the least amount of wasted lumber?



Sharpen those pencils.  Click on the photo to bigify it if you need to.  Hum the theme from Jeopardy.  And help me out, please.