Center one and right/left align other flexbox element
<p>I would like to have <code>A</code> <code>B</code> and <code>C</code> aligned in the middle.</p>

<p>How can I get <code>D</code> to go completely to the right?</p>

<p>BEFORE:</p>

<p><a href="https://i.stack.imgur.com/3t7DO.png" rel="noreferrer"><img src="https://i.stack.imgur.com/3t7DO.png" alt="enter image description here"></a></p>

<p>AFTER:</p>

<p><a href="https://i.stack.imgur.com/QFs1B.png" rel="noreferrer"><img src="https://i.stack.imgur.com/QFs1B.png" alt="enter image description here"></a></p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>ul {
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
}
li {
  display: flex;
  margin: 1px;
  padding: 5px;
  background: #aaa;
}
li:last-child {
  background: #ddd;
  /* magic to throw to the right*/
}</code></pre>
<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;ul&gt;
  &lt;li&gt;A&lt;/li&gt;
  &lt;li&gt;B&lt;/li&gt;
  &lt;li&gt;C&lt;/li&gt;
  &lt;li&gt;D&lt;/li&gt;
&lt;/ul&gt;</code></pre>
</div>
</div>
</p>

<p><a href="https://jsfiddle.net/z44p7bsx/" rel="noreferrer">https://jsfiddle.net/z44p7bsx/</a></p>