| Short-term and Long-term Investments |
The following tables represent our short-term and long-term investments in available-for-sale securities as of March 31, 2018 and December 31, 2017, based on contractual years to maturity: | | | | | | | | | | | | | | | | | | March 31, 2018 | | Amortized Cost | | Unrealized Gains | | Unrealized Losses | | Fair Value | | (in thousands) | Short-term investments | | | | | | | | U.S. treasury securities | $ | 158,727 |
| | $ | — |
| | $ | (255 | ) | | $ | 158,472 |
| U.S. agency securities | 21,407 |
| | — |
| | (94 | ) | | 21,313 |
| Corporate bonds | 62,058 |
| | — |
| | (191 | ) | | 61,867 |
| Total short-term investments | 242,192 |
| | — |
| | (540 | ) | | 241,652 |
| Long-term investments |
| |
| |
| |
| U.S. treasury securities | 99,562 |
| | — |
| | (502 | ) | | 99,060 |
| U.S. agency securities | 8,576 |
| | — |
| | (71 | ) | | 8,505 |
| Corporate bonds | 50,332 |
| | — |
| | (400 | ) | | 49,932 |
| Total long-term investments | 158,470 |
| | — |
| | (973 | ) | | 157,497 |
| Total short-term and long-term investments | $ | 400,662 |
| | $ | — |
| | $ | (1,513 | ) | | $ | 399,149 |
|
| | | | | | | | | | | | | | | | | | December 31, 2017 | | Amortized Cost | | Unrealized Gains | | Unrealized Losses | | Fair Value | | (in thousands) | Short-term investments | | | | | | | | Commercial paper | $ | 9,970 |
|
| $ | — |
|
| $ | — |
|
| $ | 9,970 |
| U.S. treasury securities | 160,206 |
| | — |
| | (121 | ) | | 160,085 |
| U.S. agency securities | 9,917 |
| | — |
| | (24 | ) | | 9,893 |
| Corporate bonds | 46,901 |
| | 3 |
| | (65 | ) | | 46,839 |
| Total short-term investments | 226,994 |
| | 3 |
| | (210 | ) | | 226,787 |
| Long-term investments | | | | | | | | U.S. treasury securities | 79,371 |
| | — |
| | (202 | ) | | 79,169 |
| U.S. agency securities | 18,570 |
| | — |
| | (102 | ) | | 18,468 |
| Corporate bonds | 50,880 |
| | — |
| | (153 | ) | | 50,727 |
| Total long-term investments | 148,821 |
| | — |
| | (457 | ) | | 148,364 |
| Total short-term and long-term investments | $ | 375,815 |
| | $ | 3 |
| | $ | (667 | ) | | $ | 375,151 |
|
|